Created
February 11, 2015 19:20
-
-
Save CGenie/a5ff3ad7e9288c0b04e6 to your computer and use it in GitHub Desktop.
RankNType question
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
{-# LANGUAGE RankNTypes #-} | |
module Main | |
where | |
class Zeroable a where | |
zero :: a -> Int | |
data Thing = Thing { x :: Int } | |
instance Zeroable Thing where | |
zero thing = 0 | |
data System = System { | |
things :: (Zeroable a) => [a] | |
} | |
mapper :: System -> [Int] | |
mapper system = map zero (things system) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment