[Haskell-cafe] Re: GATD and pattern matching
uzytkownik2 at gmail.com
Wed Jun 9 20:47:19 EDT 2010
On Wed, 2010-06-09 at 22:28 +0200, Dupont Corentin wrote:
> Thanks for your response.
> How would you do it? I design this GATD for a game i'm making:
> > data Obs a where
> > Player :: Obs Integer
> > Turn :: Obs Integer
> > Official :: Obs Bool
> > Equ :: Obs a -> Obs a -> Obs Bool --woops!!
> > Plus :: (Num a) => Obs a -> Obs a -> Obs a
> > Time :: (Num a) => Obs a -> Obs a -> Obs a
> > Minus :: (Num a) => Obs a -> Obs a -> Obs a
> > Konst :: a -> Obs a
Actually woops is here. Make it for example
Const :: (Show a, Eq a, ...) => a -> Obs a
> > And :: Obs Bool -> Obs Bool -> Obs Bool
> > Or :: Obs Bool -> Obs Bool -> Obs Bool
> For example I can design an Observable like that:
> myObs = Player `Equ` (Konst 1) `And` Official
> These Observables will then be processed during gameplay.
> I would like to be able to do in ghci:
> > show myObs
> Player `Equ` (Konst 1) `And` Official
> > myObs == myObs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 836 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100609/72e608d3/attachment.bin
More information about the Haskell-Cafe