Permalink
Browse files

instance MonadPlus Magic

  • Loading branch information...
1 parent 54d720d commit e79bba21bdcd3f5a412877e55baa2e81799f599e @MedeaMelana committed Dec 11, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 Types.hs
View
@@ -169,6 +169,8 @@ data Magic :: * -> * where
GetWorld :: Magic World
PutWorld :: World -> Magic ()
Choose :: [(Choice, a)] -> Magic a
+ Fail :: Magic a
+ Plus :: Magic a -> Magic a -> Magic a
choose :: [(Choice, a)] -> Magic a
choose = Choose
@@ -181,6 +183,10 @@ instance MonadState World Magic where
get = GetWorld
put = PutWorld
+instance MonadPlus Magic where
+ mzero = Fail
+ mplus = Plus
+
data Choice
= TargetPlayer (Ref Player)
| TargetObject (Ref Object)

0 comments on commit e79bba2

Please sign in to comment.