Skip to content

Commit

Permalink
Merge pull request #18 from fumieval/master
Browse files Browse the repository at this point in the history
The `Monad` instance for `Moore` is inconsistent
  • Loading branch information
haasn committed Mar 2, 2014
2 parents b692fbe + d5b640f commit 327c417
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Data/Machine/Moore.hs
Expand Up @@ -90,8 +90,8 @@ instance Pointed (Moore a) where
instance Monad (Moore a) where
return a = r where r = Moore a (const r)
{-# INLINE return #-}
Moore a k >>= f = case f a of
Moore b _ -> Moore b (k >=> f)
k >>= f = j (fmap f k) where
j (Moore a g) = Moore (extract a) (\x -> j $ fmap (\(Moore _ h) -> h x) (g x))
_ >> m = m

instance Copointed (Moore a) where
Expand Down

0 comments on commit 327c417

Please sign in to comment.