Last active
November 4, 2017 02:22
-
-
Save roboguy13/9fabafa92c8e85501034139687faffb7 to your computer and use it in GitHub Desktop.
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 #-} | |
exampleA :: [a] -> [a] | |
exampleA = reverse | |
exampleB :: [Int] -> [Int] | |
exampleB = filter even | |
rank2 :: (forall a. [a] -> [a]) -> [Char] | |
rank2 f = f "abc" | |
-- 'rank2 exampleA' compiles and gives the result "cba" | |
-- 'rank2 exampleB' does not type check, because 'exampleB' does not work "for all 'a' types" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment