Skip to content

Instantly share code, notes, and snippets.

@CGenie
Created February 11, 2015 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CGenie/a5ff3ad7e9288c0b04e6 to your computer and use it in GitHub Desktop.
Save CGenie/a5ff3ad7e9288c0b04e6 to your computer and use it in GitHub Desktop.
RankNType question
{-# 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