TP wrote:
But I have still a question: is the behavior of GHC correct in the example
of my initial post?
See here:
http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/type-class-extensions.html#instance-overlap
When matching, GHC takes no account of the context of the instance
definition (which is
indeed the definition in the Haskell report).
Thanks in advance,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Thanks in advance,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
In an equation for `a': a = s * s
In the expression:
do { let s = ...;
let a = s * s;
print a }
Thanks in advance,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
context? Is it OK, or is it a deficiency?
Thanks,
TP
-
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE
and ExpQ's in a separate module. Tonight, I've tried hard one more time
without more success.
Maybe I have to stick to non-let expressions in the main part of a script,
when it comes to TH. It should nevertheless allow me to call functions, make
tests, etc.
Thanks,
TP
[Language.Haskell.TH.Syntax.Dec]
-- Defined in `Language.Haskell.Meta.Parse'
:i parseExp
parseExp :: String - Either String Language.Haskell.TH.Syntax.Exp
-- Defined in `Language.Haskell.Meta.Parse'
Thanks,
TP
___
Haskell-Cafe
. Could you help me?
Thanks in advance,
TP
PS: the complete Haskell example:
---
module MakeVard where
import Language.Haskell.TH
makeVard :: Monad m = String - m [Dec]
-- Equivalent to %s = \%s\
makeVard s = return [ ValD (VarP $ mkName s) (NormalB $ LitE
, and compE is to construct
list comprehensions, which is a different thing.
So, is there any solution to my problem?
Thanks in advance,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
fragment from the error message.
Yes, I have explained why: to be able to see the evaluation of the splice;
otherwise I obtain Not in scope: `a' if I uncomment -- print a at the
end of my code; I have explained everything in my initial post.
TP
|]
it works correctly.
Why GHC is able to infer the typeclass constraint (Num a) in 1/, but not
(Lift a) in 2/?
Thanks in advance,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
Adam Gundry wrote:
If you leave off the type signature, as you did for sum', the
right thing will be inferred.
Thanks Adam and Ivan. Very stupid question...
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
can also admit that the
following version does not work (version of my initial post):
pr :: Name - ExpQ
pr n = [| putStrLn $ (nameBase n) ++ = ++ show $(varE n) |]
Thanks,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
to transform a value at
data level in a token of an AST), but it seems to me it does not answer my
question above. But I am probably wrong.
Thanks
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
for (Lift Name)
In the first argument of `nameBase', namely `n'
It is not easy to surmise the reason for this error.
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
TP wrote:
2/ If I define in a module:
j = 3
and then define in another module:
---
h x = $([|j|])
main = do
print $ h undefined
---
I obtain 3 as expected.
However, I do not achieve to make this system work with an infix
declaration:
infix
:
---
h x = $([|j|])
main = do
print $ h undefined
---
I obtain 3 as expected.
However, I do not achieve to make this system work with an infix
declaration:
infix $([| j |]) +
I obtain:
parse error on input `$('
What is the problem?
Thanks in advance,
TP
a condensed and easy to remember
notation; still better if it is easily extended to higher dimensions/orders
(unfortunately, generally these notations are not taught at university).
Regards,
TP
o...@okmij.org wrote:
Well, I guess you might be interested in geometric algebra then
http
at runtime.
We would put some placeholders in the code where the result of the pre-
processing calculation would enter.
Thanks in advance,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
(and the corresponding article) may help me in the future.
Thanks,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
to give a try with
Haskell, monads, perhaps arrows, reactive programming, etc. Very
interesting, but time-consuming. Still a long path to go for me.
Thanks,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman
one
print $ mkSNat (P one)
--
Thanks,
TP
References:
---
[1]: https://groups.google.com/forum/?fromgroups#!topic/haskell-cafe/mGDhPqHZAz8
[2]: https://groups.google.com/d/msg/haskell-cafe/Rh65kdPkX70/T2zZpV6ZpjoJ
be another type of kind Nat different from
`'Succ n` and `Zero`? If yes, is it related to the sentence I have already
read: Typeclasses are open?
Thanks,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
a = P deriving (Typeable, Show, Eq)
deriving instance Show Box
instance Eq Box where
(Box s1) == (Box s2) = Just s1 == cast s2
main = do
let one = undefined :: Main.Proxy ('Succ 'Zero)
let foo = Box one
print foo
--
Thanks a lot,
TP
had unwanted similar
error messages recently:
http://hackage.haskell.org/trac/ghc/ticket/7704
Thanks,
TP
PS: the complete program for a test that shows the error:
--
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds
, but I would be highly suspicious of code that
used this feature.)
Interesting, I will remember that.
Thanks
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
because recent improvements in Typeable are not present (1).
What is the problem? I've tried different things without success.
Tell me if the beginners diffusion list is more suitable than Haskell-
Cafe.
Thanks,
TP
(1):
http://hauptwerk.blogspot.fr/2012/11/coming-soon-in-ghc-head-poly
inhabitants, isn't it?
I hope this helps! I do have to say I'm impressed, TP, by your intrepid
path of discovery down this road. You're asking all the right questions!
Thanks Richard. I am discovering things in Haskell every day. In the last
weeks, I have especially been amazed by all
:
---
test_noinhabitant_corrected.hs: Void showsPrec
---
Why?
Thanks,
TP
References:
--
(1):
https://groups.google.com/forum/?fromgroups#!topic/haskell-cafe/AltmX5iCFi8
(2):
---
Expected a type, but ‛Succ Zero’ has kind
see how
to combine this idea of overloading or derivation function with what you
proposed. But I have perhaps missed something.
Thanks,
TP
(*): That is to say the list of tensors of which one tensor depends, e.g.
[t,r] for E(t,r), or simply [x,y,z] for f(x(t),y(t),z(t)) where x, y, and z
TP wrote:
Where are these examples that can help me to write my instance?
I have tried to read the source of the implemented instances in
data.typeable, not so easy for me.
Ok, by doing a better search on Google (instance typeable blog), I have
found interesting information:
http://blog
the order in the type
seems to be correct.
My only need to use Typeable comes from the heterogeneous list. But how to
do without?
Thanks,
TP
Richard Eisenberg wrote:
Thankfully, the problem you have is fixed in HEAD -- the most recent
version of GHC that we are actively working on. I am able
$ a == a
--
Is this the right way to go? Is there any other solution?
Thanks,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
. But there are plenty of examples for how to do it
safely.
Where are these examples that can help me to write my instance?
I have tried to read the source of the implemented instances in
data.typeable, not so easy for me.
Thanks,
TP
___
Haskell-Cafe
). The problem is that I am compelled to repeat the context
(PrettyPrint (Person a), PrettyPrint (Person b)) for each one of the
constructors. Is there any way to specify the context only once? I have
tried using forall, but without any success.
Thanks,
TP
-
{-# LANGUAGE GADTs
”
++ (show (c2num order))
Thanks in advance,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
signature of Child, we have a more general
(Person a) - (Person b). So he tries to find an implementation of prettify
in PrettyPrint (Person a), but there is none.
Is there any workaround?
Thanks,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe
a } - forall (b ::
Gender). Person b
deriving instance Show (forall (a :: Gender). Person a)
main = do
let a = Alive Joe 60 Dead :: Person Female
let b = Alive Jim 70 a :: Person Male
Thanks,
TP
___
Haskell-Cafe mailing list
:: String
, weight :: Float
, father :: Person b } - Person a
deriving instance Show (Person a)
Thanks so much, it is now perfectly clear. A lot of things learned with this
dummy example.
TP
___
Haskell-Cafe mailing list
Richard Eisenberg wrote:
There's a lot of recent work on GHC that might be helpful to you. Is it
possible for your application to use GHC 7.6.x? If so, you could so
something like this:
{-# LANGUAGE DataKinds, GADTs, KindSignatures #-}
data Nat = Zero | Succ Nat
type One = Succ Zero
this is because there is an infinite loop in the construction
of the show function)? Is there any workaround?
Thanks,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
b = Alive Jim 70 a :: Person Male
print a
print b
How to modify it?
Thanks a lot,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
to my
needs.
Thanks a lot,
TP
On Sunday, April 28, 2013 07:58:58 Stephen Tetley wrote:
What you probably want are type level integers (naturals)
Yury Sulsky used them in the message above - basically you can't use
literal numbers 1,2,3,... etc as they are values of type Int (or
Integer
,
TP
On Monday, April 29, 2013 08:19:43 Richard Eisenberg wrote:
There's a lot of recent work on GHC that might be helpful to you. Is it
possible for your application to use GHC 7.6.x? If so, you could so
something like this:
{-# LANGUAGE DataKinds, GADTs, KindSignatures #-}
data Nat
-language:
data Vector = TensorVar 1 String
Because a vector is a tensor of order 1.
Is this possible? I have tried type synonyms and newtypes without any success.
Thanks a lot,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
duplicating code, by reusing the tensor type and data
constructor. At some place in my code, in some definition (say, of a vector
product), I want vectors and not more general tensors.
TP
On Saturday, April 27, 2013 16:16:49 Yury Sulsky wrote:
Hi TP,
Are you looking to use a phantom types here? Here's
Hi,
I am currently reading documentation on Generalized Algebraic Data Types:
http://en.wikibooks.org/wiki/Haskell/GADT
I have a question concerning this page. Let us consider the following code
proposed in the page:
--
-- Phantom type variable a (does not
for «a» in «Expr a» input type of eval. These
multiplicity of values for «a» cannot match the output type of the equation
«eval (I n) = n» which is an Int. Thus we get an error.
Am I correct?
Thanks,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe
to comment all the Show instances of
my code, and add Show in deriving (...) for each of my types? If this is
the only possibility, is there some script around here to do that
automatically?
Thanks in advance,
TP
___
Haskell-Cafe mailing list
Haskell-Cafe
several lines as in classical Computer
Algebra Sytems). Why not using my own Show implementation to do that?
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
instance [overlap ok] Show [Foo]
-- Defined at test_overlappinginstances.hs:5:10-19
The overlap is ok (overlap ok does not appear if not using the pragma
OverlappingInstances), so it should work?
Thanks in advance,
TP
don't see why it could not work.
Thanks
TP
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hi,
I don't known the advanced features and extensions of GHC at all.
Look at the following program:
f :: Integer - Integer - IO Integer
f a b = do
print $ first argument= ++ (show a)
print $ second argument= ++ (show b)
print $ a+b
return (a+b)
main = do
k
to do that?
I have tried:
---
instance Num ListOfInt where
l1 + l2 = ListOfInt $ getZipList $ (+) $ ZipList (getList l1) *
ZipList (getList l2)
---
Isn't it too much complicated?
Thanks
TP
with ocamlrun is that the process of
generating the bytecode is very fast, so it is very convenient to test the
program being written, in an efficient workflow. Only at the end the program is
compiled to get more execution speed.
Thanks a lot in advance.
TP
PS:
---
To test the OCaml tutorial, type
56 matches
Mail list logo