Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Problems with Data types a la carte (Rodrigo Geraldo)
2. Re: Problems with Data types a la carte (Daniel Fischer)
----------------------------------------------------------------------
Message: 1
Date: Fri, 23 Apr 2010 17:52:19 -0300
From: Rodrigo Geraldo <[email protected]>
Subject: [Haskell-beginners] Problems with Data types a la carte
To: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
Skipped content of type multipart/alternative-------------- next part
--------------
A non-text attachment was scrubbed...
Name: Main.hs
Type: text/x-haskell
Size: 628 bytes
Desc: not available
Url :
http://www.haskell.org/pipermail/beginners/attachments/20100423/a85c8b0e/Main-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Eval.hs
Type: text/x-haskell
Size: 869 bytes
Desc: not available
Url :
http://www.haskell.org/pipermail/beginners/attachments/20100423/a85c8b0e/Eval-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Expr.hs
Type: text/x-haskell
Size: 1083 bytes
Desc: not available
Url :
http://www.haskell.org/pipermail/beginners/attachments/20100423/a85c8b0e/Expr-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Inject.hs
Type: text/x-haskell
Size: 1098 bytes
Desc: not available
Url :
http://www.haskell.org/pipermail/beginners/attachments/20100423/a85c8b0e/Inject-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mult.hs
Type: text/x-haskell
Size: 823 bytes
Desc: not available
Url :
http://www.haskell.org/pipermail/beginners/attachments/20100423/a85c8b0e/Mult-0001.bin
------------------------------
Message: 2
Date: Fri, 23 Apr 2010 23:35:54 +0200
From: Daniel Fischer <[email protected]>
Subject: Re: [Haskell-beginners] Problems with Data types a la carte
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"
Am Freitag 23 April 2010 22:52:19 schrieb Rodrigo Geraldo:
> Hi !
>
> I've tried to implement the expression interpreter present in Data types
> a la carte, putting the new "cases" of my data type in a separate
> module. When I'm trying to create a simple
> expression like this:
>
> x :: Expr (Val :+: Add :+: Mult)
> x = (val 2000 `mult` val 399) `plus` (val 3)
>
> I'm getting the following type error that I can't solve:
>
Your problem is the wrong associativity, the type signature is parsed as
Expr ((Val :+: Add) :+: Mult)
while you need
Expr (Val :+: (Add :+: Mult))
Insert the parentheses or add a fixity declaration
infixr k :+:
to Expr.hs (where k must be replaced with an integer from 0 through 9).
>
> Regards
>
> Rodrigo
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 22, Issue 37
*****************************************