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. Monad instances and type synonyms (Christopher Howard)
----------------------------------------------------------------------
Message: 1
Date: Sat, 13 Apr 2013 17:03:57 -0800
From: Christopher Howard <[email protected]>
Subject: [Haskell-beginners] Monad instances and type synonyms
To: Haskell Beginners <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"
I am playing around with some trivial code (for learning purposes) I
wanted to take
code:
--------
-- SaleVariables a concrete type defined early
-- `Adjustment' represents adjustment in a price calculation
-- Allows functions of type (a -> Adjustment a) to be composed
-- with an appropriate composition function
type Adjustment a = SaleVariables -> a
--------
And put it into
code:
--------
instance Monad Adjustment where
(>>=) = ...
return = ...
--------
If I try this, I get
code:
--------
Type synonym `Adjustment' should have 1 argument, but has been given none
In the instance declaration for `Monad Adjustment'
--------
But if I give an argument, then it doesn't compile either (it becomes a
"*" kind). And I didn't want to make the type with a regular "data"
declaration either, because then I have to give it a constructor, which
doesn't fit with what I want the type to do.
--
frigidcode.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL:
<http://www.haskell.org/pipermail/beginners/attachments/20130413/56ba5159/attachment-0001.pgp>
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 58, Issue 27
*****************************************