Last active
August 29, 2015 14:10
-
-
Save deech/9d4eb66acd18b74cab6a 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 TypeFamilies, UndecidableInstances #-} | |
data A = A | |
data B = B | |
data Found a = Found a | |
data NotFound = NotFound | |
type family F x | |
type instance F A = Found (Int -> Int) | |
type family FindF x where | |
FindF f = CheckFoundF (F f) | |
type family CheckFoundF res where | |
CheckFoundF (Found f) = f | |
CheckFoundF notfound = NotFound | |
test :: FindF B | |
test = undefined | |
{- | |
*Main> test | |
<interactive>:150:1: | |
No instance for (Show (CheckFoundF (F B))) <==== Should be (Show NotFound) | |
arising from a use of ‘print’ | |
In a stmt of an interactive GHCi command: print it | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment