Last active
January 19, 2019 16:48
-
-
Save lukaszlew/e3251f576f66f6bde2c5cb4646851707 to your computer and use it in GitHub Desktop.
Another exposition of Edward's "Closed kinds aren't as closed as you'd think"
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 TypeApplications #-} | |
{-# language TypeFamilies #-} | |
{-# language FlexibleInstances #-} | |
{-# language ScopedTypeVariables #-} | |
data Unit = U | |
class C (k :: Unit) where | |
get :: Int | |
instance C 'U where | |
get = 0 | |
-- this can be defined already here | |
standaloneGet :: forall (t :: Unit) . C t => Int | |
standaloneGet = get @t | |
-- the problematic 'matchable' type family | |
type family Succ :: Unit -> Unit | |
-- Note that this is different: | |
type family Succ1 (x :: Unit) :: Unit | |
instance C (f 'U) where | |
get = 1 | |
results :: [Int] | |
results = [get @'U, get @(Succ 'U)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment