Created
February 17, 2013 04:43
-
-
Save xenophobia/4970216 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
| {-# Language FlexibleInstances, ScopedTypeVariables #-} | |
| class AddNType t where | |
| adds :: Int -> t | |
| instance AddNType Int where | |
| adds = id | |
| instance AddNType t => AddNType (Int -> t) where | |
| adds n = \m -> (adds (n+m) :: t) | |
| addN :: AddNType t => t | |
| addN = adds 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment