You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using a bunch of type-level combinators to deal with indexed types without explicitly plumbing the index everywhere. I'm also using an implicit coercion to automatically wrap some indexed values in a record wherever the expected type and the type of the expression I give don't match up.
Declaring an implicit with the type All (Vec a :-> Wrap (Vec a)) leads to argh being rejected with the error:
BugReport.idr:31:10-11:When checking right hand side of argh with expected type
Wrap (Vec a) n
Type mismatch between
Vec a n (Typeof k)
andWrap (Vec a) n (Expected type)
Manually normalising the type of wrapVec to Vec a n -> Wrap (Vec a) n solves the issue.
module BugReport
%defaulttotal
%access public export
-- Indexed arrowsinfixr1:->
(:->) : (a, b : i ->Type) -> (i ->Type)
(:->) a b i = a i -> b i
-- Universal quantifierAll: (a : i -> Type) ->TypeAll {i} a = {i: i} -> a i
-- An example of a Nat-indexed familydataVec:Type->Nat->TypewhereNil: Vec a Z
Cons: a -> Vec a n -> Vec a (S n)
-- The type of wrappers for Nat-indexed families
record Wrap (A:Nat->Type) (n : Nat) where
constructor MkWrapUnWrap: A n
-- Implicit coercion from vecs to wrapped vecsimplicitwrapVec: All (Vec a :-> Wrap (Vec a))
wrapVec =MkWrap{- solution:implicit wrapVec : Vec a n -> Wrap (Vec a) nwrapVec = MkWrap-}argh: Vec a n -> Wrap (Vec a) n
argh k = k
I'd expect Idris to do the normalisation of the implicit's type itself.
The text was updated successfully, but these errors were encountered:
gallais
added a commit
to gallais/idris-tparsec
that referenced
this issue
Nov 20, 2017
I'm using a bunch of type-level combinators to deal with indexed types without explicitly plumbing the index everywhere. I'm also using an implicit coercion to automatically wrap some indexed values in a record wherever the expected type and the type of the expression I give don't match up.
Declaring an
implicit
with the typeAll (Vec a :-> Wrap (Vec a))
leads toargh
being rejected with the error:Manually normalising the type of
wrapVec
toVec a n -> Wrap (Vec a) n
solves the issue.I'd expect Idris to do the normalisation of the
implicit
's type itself.The text was updated successfully, but these errors were encountered: