Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Control/Monad/Union.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ data UState s l = UState {

-- | Union find monad.
newtype UnionM l a = U {
runU :: (forall s . StateT (UState s l) (ST s) a)
runU :: forall s . StateT (UState s l) (ST s) a
}

instance Monad (UnionM l) where
return x = U (return x)
f >>= b = U (runU f >>= runU . b)
f >>= b = U (runU f >>= \v -> runU (b v))

instance Functor (UnionM l) where
fmap = liftM
Expand All @@ -50,7 +50,7 @@ instance Applicative (UnionM l) where
(<*>) = ap

instance MonadFix (UnionM l) where
mfix a = U (mfix (runU . a))
mfix a = U (mfix (\v -> runU (a v)))

-- | Run a union find computation.
run :: UnionM l a -> a
Expand Down