Skip to content

Instantly share code, notes, and snippets.

@jroesch
Created March 30, 2014 04:40
Show Gist options
  • Select an option

  • Save jroesch/9867644 to your computer and use it in GitHub Desktop.

Select an option

Save jroesch/9867644 to your computer and use it in GitHub Desktop.
Simple RankNTypes example
{-# LANGUAGE RankNTypes #-}
module IdExamples where
vanilla :: (a -> a) -> a -> a
vanilla f i =
let shouldWork = f (1 :: Int)-- won't actually work
in f i
rankNVersion :: (forall a. a -> a) -> b -> b
rankNVersion f i =
let works = f 1
in f i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment