Safe Haskell | None |
---|---|
Language | Haskell2010 |
Agda.Utils.Zip
Description
This module provides the Zip
class to overload zipping functions
for variants of the list type ('[]', List1
, List2
, ListInf
).
Motivation:
In practice, we often zip a finite list with an infinite list,
e.g. zipWith f xs (ys ++ repeat z)
.
We can know statically in this case that the resulting considers
each xs
by rewriting this to zipWith f xs (ListInf.pad ys z)
statically exposing the infinite nature of the second list.
To avoid cluttering the namespace with 4*4 variants of zipWith
for all combination of our list types, we introduce an overloaded version.
Import this module as follows:
import Prelude hiding (zip, zipWith) import Agda.Utils.Zip
Documentation
class Zip (f :: Type -> Type) (g :: Type -> Type) (h :: Type -> Type) | f g -> h where Source #
Minimal complete definition
Instances
Zip List1 List1 List1 Source # | |
Zip List1 List2 List1 Source # | |
Zip List1 ListInf List1 Source # | |
Zip List1 [] [] Source # | |
Zip List2 List1 List1 Source # | |
Zip List2 List2 List2 Source # | |
Zip List2 ListInf List2 Source # | |
Zip List2 [] [] Source # | |
Zip ListInf List1 List1 Source # | |
Zip ListInf List2 List2 Source # | |
Zip ListInf ListInf ListInf Source # | |
Zip ListInf [] [] Source # | |
Zip [] List1 [] Source # | |
Zip [] List2 [] Source # | |
Zip [] ListInf [] Source # | |
Zip [] [] [] Source # | |