Commit 6d5c2e7b authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

NCGMonad: Add MonadUnique NatM instance

Test Plan: Validate

Reviewers: austin, simonmar

Reviewed By: simonmar

Subscribers: thomie

Differential Revision:
parent 77532735
......@@ -95,6 +95,14 @@ instance Applicative NatM where
instance Monad NatM where
(>>=) = thenNat
instance MonadUnique NatM where
getUniqueSupplyM = NatM $ \st ->
case splitUniqSupply (natm_us st) of
(us1, us2) -> (us1, st {natm_us = us2})
getUniqueM = NatM $ \st ->
case takeUniqFromSupply (natm_us st) of
(uniq, us') -> (uniq, st {natm_us = us'})
thenNat :: NatM a -> (a -> NatM b) -> NatM b
thenNat expr cont
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment