11 | {-------------------------------------------------------------------------------
12 | This file defines a number of different containers
13 | Some of them are possible to express in terms of each other, but we opt to define all of them directly
14 | -------------------------------------------------------------------------------}
16 | ||| Constant (non-dependent) container: positions do not depend on shapes
17 | ||| As a polynomial functor: F(X) = aX^b
22 | ||| Constant container whose shapes and positions coincide
23 | ||| As a polynomial functor: F(X) = aX^a
28 | ||| Naperian container: a constant container with a single shape
29 | ||| As a polynomial functor: F(X) = X^b
34 | ||| Flat container: a constant container with a single position
35 | ||| As a polynomial functor: F(X) = aX
40 | ||| Sharp container: a constant container without any positions
41 | ||| As a polynomial functor: F(X) = a
46 | ||| Empty container, isomorphic to Void
47 | ||| As a polynomial functor: F(X) = 0
48 | ||| Initial container
53 | ||| Container of a single thing
54 | ||| As a polynomial functor: F(X) = X
59 | ||| Container with a single shape, but no positions. Isomorphic to Unit : Type
60 | ||| As a polynomial functor: F(X) = 1
61 | ||| Terminal container
66 | ||| Product, container of two things
67 | ||| Isomorphic to Scalar >*< Scalar
68 | ||| As a polynomial functor: F(X) = X^2
73 | ||| Coproduct, container of either one of two things
74 | ||| Isomorphic to Scalar >+< Scalar
75 | ||| As a polynomial functor: F(X) = X + X
80 | ||| Container of either one thing, or nothing
81 | ||| Isomorphic to Scalar >+< UnitCont
82 | ||| Initial algebra is Nat
83 | ||| As a polynomial functor: F(X) = 1 + X
88 | ||| Container of either two things, or nothing
89 | ||| Isomorphic to Pair >+< UnitCont
90 | ||| Initial algebra is BinTreeShape
91 | ||| As a polynomial functor: F(X) = 1 + X^2
96 | ||| List, container with an arbitrary number of things
97 | ||| As a polynomial functor: F(X) = 1 + X + X^2 + X^3 + ...
102 | ||| Vect, container of a fixed/known number of things
103 | ||| As a polynomial functor: F(X) = X^n
108 | ||| Grid, container of things arranged along two axes
109 | ||| As a polynomial functor: F(X) = X^(hw)
114 | ||| Container of an infinite number of things
115 | ||| As a polynomial functor: F(X) = X^Nat
120 | ||| Container of things stored at nodes and leaves of a binary tree
121 | ||| As a polynomial functor: F(X) = 1 + 2X + 3X^2 + 7X^3 + ...
126 | ||| Container of things stored at nodes of a binary tree
127 | ||| As a polynomial functor: F(X) = 1 + X + 2X^2 + 5X^3 +
132 | ||| Container of things stored at leaves of a binary tree
133 | ||| As a polynomial functor: F(X) = X + X^2 + 2X^3 + 5X^4 +
138 | ||| Tensors are containers
139 | ||| As a polynomial functor: F(X) = ?
156 | ||| Ignoring universe levels here
157 | ||| This should be the analogue of `Type : Type`
162 | ||| Given a natural number `n`, this is a container whose shape represents a
163 | ||| distribution over `n` choices, and its position represents the choice made.