Last active
February 8, 2026 21:14
-
-
Save danidiaz/257bac0a6a0fedc57a8c1cc108d1b9fc to your computer and use it in GitHub Desktop.
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 GHC2024 #-} | |
| {-# OPTIONS_GHC -Wincomplete-patterns #-} | |
| module Main where | |
| import Data.Kind | |
| import GHC.Exts | |
| import Data.Void | |
| -- Unlifted types | |
| -- | |
| type Brancho :: Type -> Type | |
| data Brancho e = | |
| MkBrancho !e | |
| | MkAnotherBrancho Int | |
| deriving Show | |
| branchy1 :: Brancho () | |
| branchy1 = MkAnotherBrancho 0 | |
| branchy2 :: Brancho Void | |
| branchy2 = MkAnotherBrancho 0 | |
| main :: IO () | |
| main = do | |
| case branchy1 of | |
| MkBrancho () -> putStrLn "foo" | |
| MkAnotherBrancho _ -> putStrLn "foo" | |
| case branchy2 of | |
| -- compiler is smart enough to know one branch is impossible | |
| MkAnotherBrancho _ -> putStrLn "foo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment