Last active
June 4, 2020 16:35
-
-
Save wz1000/bdbabe1f112f04416fe0d44ae1e7fcf6 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 DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeApplications #-} | |
data X = C | |
data SX x where | |
SC :: SX C | |
foo :: SX x -> IO () | |
foo x = do | |
case x of | |
SC -> pure () | |
pure () | |
{- | |
bug.hs:12:11: error: | |
• Couldn't match type ‘a0’ with ‘()’ | |
‘a0’ is untouchable | |
inside the constraints: x ~ 'C | |
bound by a pattern with constructor: SC :: SX 'C, | |
in a case alternative | |
at newbug.hs:12:5-6 | |
Expected type: IO a0 | |
Actual type: IO () | |
• In the expression: pure () | |
In a case alternative: SC -> pure () | |
In a stmt of a 'do' block: case x of { SC -> pure () } | |
| | |
13 | SC -> pure () | |
| ^^^^^^^ | |
-} | |
-- Works | |
bar :: SX x -> IO () | |
bar x = do | |
id @(IO ()) $ case x of | |
SC -> pure () | |
pure () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment