Created
February 14, 2014 05:32
-
-
Save startling/8996300 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
-- bound | |
import Bound | |
-- | Standalone type for 'let' bindings. | |
data Lets f v = Lets (f v) (Scope () f v) | |
instance Bound Lets where | |
Lets l b >>>= f = Lets (l >>= f) (b >>>= f) | |
-- | Abstract syntax trees with optional extra types involved. | |
data Abstract l v | |
= Free v -- ^ Free variables. | |
| With (l (Abstract l) v) -- ^ Other types. | |
| Apply (Abstract l v) (Abstract l v) -- ^ Function application. | |
instance Bound l => Monad (Abstract l) where | |
return = Free | |
Free v >>= f = f v | |
With l >>= f = With (l >>>= f) | |
Apply a b >>= f = Apply (a >>= f) (b >>= f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment