[Haskell-beginners] Writer and mappend
Isaac Dupree
ml at isaac.cedarswampstudios.org
Tue Mar 15 21:42:00 CET 2011
On 03/15/11 16:18, Britt Anderson wrote:
> Or can I do something like
>
> instance Monoid MyDat where
> mempty = Mydat [] 0
> mappend a b = (Mydat (mappend (list1 a) (list1 b)) (item1 a))
>
> without defining an instance for Float?
Yes, you can do this. Try it! Does it typecheck? Then there's a large
chance it's correct! (In addition to more-philosophical reasons.)
-Isaac
More information about the Beginners
mailing list