Created
November 30, 2009 21:54
-
-
Save abuiles/245785 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BuildList r where | |
type Build r | |
build' :: [Build r] -> Build r -> r | |
instance BuildList [a] where | |
type Build [a] = a | |
build' l x = reverse $ x:l | |
instance BuildList r => BuildList (a-> r) where | |
type Build (a -> r) = Build r | |
build' l x = \ y -> build'(x:l) y | |
-- --build :: forall r a. (BuildList a r) => a -> r | |
-- build :: (BuildList a r) => a -> r | |
-- build x = build' [] x | |
class Mutation m where | |
type Ref m :: * -> * | |
newRef :: a -> m (Ref m a) | |
readRef :: (Ref m a) -> m a | |
writeRef :: (Ref m a) -> a -> m () | |
instance Mutation IO where | |
type Ref IO = IORef | |
newRef = newIORef | |
readRef = readIORef | |
writeRef = writeIORef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment