tweak some type signatures

This commit is contained in:
rhiannon morris 2021-11-21 14:59:27 +01:00
parent 81fc802fa8
commit 37230a8032

View file

@ -169,14 +169,14 @@ zipWith3Lazy : forall tm1, tm2, tm3, tm4.
Telescope tm2 from to -> Telescope tm2 from to ->
Telescope tm3 from to -> Telescope tm3 from to ->
Telescope (\n => Lazy (tm4 n)) from to Telescope (\n => Lazy (tm4 n)) from to
zipWith3Lazy f = zipWith3 (\x, y, z => delay $ f x y z) zipWith3Lazy f = zipWith3 $ \x, y, z => delay $ f x y z
export export
lengthPrf : Telescope _ from to -> Subset Nat (\len => len + from = to) lengthPrf : Telescope _ from to -> Subset Nat $ \len => len + from = to
lengthPrf [<] = Element 0 Refl lengthPrf [<] = Element 0 Refl
lengthPrf (tel :< _) = lengthPrf (tel :< _) = let len = lengthPrf tel in
let len = lengthPrf tel in Element (S len.fst) (cong S len.snd) Element (S len.fst) (cong S len.snd)
public export %inline public export %inline
length : Telescope {} -> Nat length : Telescope {} -> Nat
@ -196,40 +196,40 @@ parameters {auto _ : Monoid a}
foldMap f = foldl (\acc, tm => acc <+> f tm) neutral foldMap f = foldl (\acc, tm => acc <+> f tm) neutral
export %inline export %inline
fold : Telescope (\x => a) from to -> a fold : Telescope' a from to -> a
fold = foldMap id fold = foldMap id
||| like `fold` but calculate the elements only when actually appending ||| like `fold` but calculate the elements only when actually appending
export %inline export %inline
foldLazy : Telescope (\x => Lazy a) from to -> a foldLazy : Telescope' (Lazy a) from to -> a
foldLazy = foldMap force foldLazy = foldMap force
export %inline export %inline
and : Telescope' (Lazy Bool) from to -> Bool and : Telescope' (Lazy Bool) _ _ -> Bool
and = force . fold @{All} and = force . fold @{All}
export %inline export %inline
all : (forall n. f n -> Bool) -> Telescope f from to -> Bool all : (forall n. tm n -> Bool) -> Telescope tm _ _ -> Bool
all p = and . map (delay . p) all p = and . map (delay . p)
export %inline export %inline
all2 : (forall n. f n -> g n -> Bool) -> all2 : (forall n. tm n -> tm2 n -> Bool) ->
Telescope f from to -> Telescope g from to -> Bool Telescope tm from to -> Telescope tm2 from to -> Bool
all2 p = and .: zipWithLazy p all2 p = and .: zipWithLazy p
export %inline export %inline
or : Telescope' (Lazy Bool) from to -> Bool or : Telescope' (Lazy Bool) _ _ -> Bool
or = force . fold @{Any} or = force . fold @{Any}
export %inline export %inline
any : (forall n. f n -> Bool) -> Telescope f from to -> Bool any : (forall n. tm n -> Bool) -> Telescope tm _ _ -> Bool
any p = or . map (delay . p) any p = or . map (delay . p)
export %inline export %inline
any2 : (forall n. f n -> g n -> Bool) -> any2 : (forall n. tm1 n -> tm2 n -> Bool) ->
Telescope f from to -> Telescope g from to -> Bool Telescope tm1 from to -> Telescope tm2 from to -> Bool
any2 p = or .: zipWithLazy p any2 p = or .: zipWithLazy p