Skip to content

Instantly share code, notes, and snippets.

@Heimdell
Created February 7, 2016 19:35
Show Gist options
  • Save Heimdell/0b7521d949a67ba5c6ae to your computer and use it in GitHub Desktop.
Save Heimdell/0b7521d949a67ba5c6ae to your computer and use it in GitHub Desktop.
{-# LANGUAGE DataKinds, GADTs, KindSignatures #-}
data RedBlack :: (Bool -> *) where
Red :: RedBlack 'False -> RedBlack 'True
Black :: RedBlack a -> RedBlack b
Stop :: RedBlack a
test = Red $ Black $ Red $ Stop
--test1 = Red $ Red $ Stop
--
-- causes:
-- src/Lol.hs:10:15:
-- Couldn't match type ‘'True’ with ‘'False’
-- Expected type: RedBlack 'False
-- Actual type: RedBlack 'True
-- In the second argument of ‘($)’, namely ‘Red $ Stop’
-- In the expression: Red $ Red $ Stop
-- In an equation for ‘test1’: test1 = Red $ Red $ Stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment