Last active
January 10, 2018 01:57
-
-
Save MonoidMusician/6595ab108f958bd287c879103fc36f57 to your computer and use it in GitHub Desktop.
Impredicativity woes
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
module Main where | |
import Prelude | |
import Data.Maybe (Maybe(..), fromMaybe) | |
import Unsafe.Coerce (unsafeCoerce) | |
type Id = forall a. a -> a | |
newtype ID = ID Id | |
mkID :: Id -> ID | |
mkID = ID | |
runID :: ID -> Id | |
runID (ID id') = id' | |
aThing' :: Maybe ID | |
aThing' = Nothing | |
runAThing' :: Id | |
runAThing' = runID (fromMaybe (mkID id) aThing') | |
choose :: forall f b. Functor f => f Id -> f (b -> b) | |
choose faa = faa <#> \a -> a | |
aThing :: Maybe (forall a. a -> a) | |
aThing = (Just :: Id -> Maybe Id) id | |
runAThing :: forall z. z -> z | |
runAThing = (fromMaybeId :: Maybe (z -> z) -> (z -> z)) (choose aThing :: Maybe (z -> z)) where | |
fromMaybeId :: Maybe (z -> z) -> z -> z | |
fromMaybeId = (fromMaybe :: (z -> z) -> Maybe (z -> z) -> (z -> z)) (id :: z -> z) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment