Created
December 28, 2017 00:18
-
-
Save kcsongor/a2d03704cd27eafdbcc824648e317740 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 PolyKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Stuck where | |
data Tag = Tag | |
type family Fam :: k -> Tag -> k | |
type family IsTagged (a :: k) :: Bool where | |
IsTagged (a 'Tag) = 'True | |
IsTagged (a _) = 'False | |
-- These two cases work perfectly: | |
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
-- | |
-- >>> :kind! IsTagged (Maybe Int) | |
-- IsTagged (Maybe Int) :: Bool | |
-- = 'False | |
-- | |
-- >>> :kind! IsTagged (Fam Int 'Tag) | |
-- IsTagged (Fam Int 'Tag) :: Bool | |
-- = 'True | |
-- But this one doesn't reduce... why? | |
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
-- | |
-- >>> :kind! IsTagged (Fam Maybe 'Tag Int) | |
-- IsTagged (Fam Maybe 'Tag Int) :: Bool | |
-- = IsTagged (Fam Maybe 'Tag Int) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment