Created
January 5, 2016 13:00
-
-
Save rampion/704d3b906e937b931793 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 GADTs #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE DataKinds #-} | |
module Temp where | |
data A = A1 | A2 | |
data B = B1 | B2 | |
data C (a :: A) (b :: B)where | |
C1 :: Int -> C a b | |
C2 :: Char -> C 'A1 b | |
C3 :: Bool -> C 'A1 'B1 | |
type family ResT (b :: B) where | |
ResT B1 = C 'A1 'B1 | |
ResT B2 = C 'A2 'B2 | |
data D (b :: B) where | |
D1 :: ResT 'B1 -> C 'A1 'B1 -> D 'B1 | |
D2 :: ResT b -> C 'A1 b -> D b | |
intermediate_func1 :: Int -> D 'B1 | |
intermediate_func1 i = D2 (C1 i) (C1 i) | |
intermediate_func2 :: Int -> D 'B2 | |
intermediate_func2 i = D2 (C1 i) (C1 i) | |
intermediate_func :: Int -> D (b :: B) | |
intermediate_func i = D2 (C1 i) (C1 i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment