Created
November 30, 2009 20:41
-
-
Save diegoeche/245726 to your computer and use it in GitHub Desktop.
This file contains 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' :: [a] -> a -> Build r a | |
instance BuildList a [a] where | |
type Build [a] = [a] | |
build' l x = reverse $ x:l | |
instance BuildList a r => BuildList a (a -> r) where | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment