Created
February 6, 2014 00:16
-
-
Save djv/8836081 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, StandaloneDeriving #-} | |
data List a b where | |
Nil :: List a b | |
ConsI :: Int -> List Bool Int -> List Int Bool | |
ConsB :: Bool -> List Int Bool -> List Bool Int | |
deriving instance (Show a, Show b) => Show (List a b) |
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
*Main> :t ConsI 1 (ConsB True Nil) | |
ConsI 1 (ConsB True Nil) :: List Int Bool | |
*Main> :t ConsI 1 (ConsI True Nil) | |
<interactive>:1:10: | |
Couldn't match expected type `Bool' with actual type `Int' | |
Expected type: List Bool Int | |
Actual type: List Int Bool | |
In the return type of a call of `ConsI' | |
In the second argument of `ConsI', namely `(ConsI True Nil)' | |
*Main> :t ConsI 1 (ConsI 2 Nil) | |
<interactive>:1:10: | |
Couldn't match expected type `Bool' with actual type `Int' | |
Expected type: List Bool Int | |
Actual type: List Int Bool | |
In the return type of a call of `ConsI' | |
In the second argument of `ConsI', namely `(ConsI 2 Nil)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment