[Haskell-beginners] Trying to find an alternative StateMonad

HASHIMOTO, Yusaku nonowarn at gmail.com
Wed Apr 14 19:10:51 EDT 2010


It is GADTs (Generalized Algebric Data Types) Notation.

>> data StateCmd a where
>>        Put :: a -> StateCmd a
>>        Undo :: StateCmd a
>>        Redo :: StateCmd a

is same as

> data StateCmd a = Put a | Undo | Redo

-nwn

On 15 April 2010 07:49, Patrick LeBoutillier
<patrick.leboutillier at gmail.com> wrote:
> Hi,
>
> Sorry I can't be of much help here, but I have a question though:
>
>>
>> data StateCmd a where
>>        Put :: a -> StateCmd a
>>        Undo :: StateCmd a
>>        Redo :: StateCmd a
>>                deriving (Show, Functor)
>
> I'm not familiar with the above syntax (data ... where). What does it
> do exactly?
>
> Patrick
>
>
>
> --
> =====================
> Patrick LeBoutillier
> Rosemère, Québec, Canada
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>


More information about the Beginners mailing list