Created
October 9, 2016 07:52
-
-
Save lotz84/a69326407418f35f4b64b7387a023fd7 to your computer and use it in GitHub Desktop.
Line 10 is correct but line 11 is incorrect.
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 RankNTypes #-} | |
action :: ((forall s. s -> s) -> IO ()) -> IO () | |
action f = f id | |
f :: (forall s. s -> s) -> () | |
f _ = () | |
main = do | |
action (\x -> pure $ f x) | |
action (pure . f) |
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
$ stack ghc -- --version | |
The Glorious Glasgow Haskell Compilation System, version 8.0.1 | |
$ stack runghc Main.hs | |
Main.hs:11:18: error: | |
• Couldn't match type ‘s0 -> s0’ with ‘forall s. s -> s’ | |
Expected type: (s0 -> s0) -> () | |
Actual type: (forall s. s -> s) -> () | |
• In the second argument of ‘(.)’, namely ‘f’ | |
In the first argument of ‘action’, namely ‘(pure . f)’ | |
In a stmt of a 'do' block: action (pure . f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a secret feature of GHC.