Skip to content

Instantly share code, notes, and snippets.

@luochen1990
Created January 13, 2018 03:48
Show Gist options
  • Save luochen1990/aede3cb3f9180c49af99a52064fe737b to your computer and use it in GitHub Desktop.
Save luochen1990/aede3cb3f9180c49af99a52064fe737b to your computer and use it in GitHub Desktop.
Idris 1.2.0 can not infer type of tuple in Dependent Pair
data Color = Red | Blue
data Size = S | M | L
data Ball : (c : Color) -> (s : Size) -> Type where
MkRedSBall : Ball Red S
MkRedMBall : Ball Red M
arr : List (c : Color ** s : Size ** Ball c s)
arr = [(Red ** S ** MkRedSBall), (Red ** M ** MkRedMBall)]
arr' : List (c : Color ** s : Size ** Ball c s)
arr' = [(_ ** _ ** MkRedSBall), (_ ** _ ** MkRedMBall)]
arr2 : List (cs : (Color, Size) ** Ball (fst cs) (snd cs))
arr2 = [((Red, S) ** MkRedSBall), ((Red, M) ** MkRedMBall)]
arr2' : List (cs : (Color, Size) ** Ball (fst cs) (snd cs))
arr2' = [((_, _) ** MkRedSBall), ((Red, M) ** MkRedMBall)]
-- failed to infer type of _
--arr2'' : List (cs : (Color, Size) ** Ball (fst cs) (snd cs))
--arr2'' = [(_ ** MkRedSBall), ((Red, M) ** MkRedMBall)]
-- failed to parse pattern-matching-style in '**' syntax
--arr3 : List ((c : Color, s : Size) ** Ball c s)
--arr3 = [((Red, S) ** MkRedSBall), ((Red, M) ** MkRedMBall)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment