Safe Haskell | None |
---|---|
Language | Haskell2010 |
While NoMonoLocalBinds could be enabled in TIP.hs, the ghc manual warns "type inference becomes less predicatable if you do so. (Read the papers!)". These definitions don't need type families, putting these definitions in a separate module avoids that mess.
XXX these should be implemented in terms of HTuple
and tipyProject
,
which means adding
- tipyTuple :: (HOccurs l1 (r v1), HOccurs l1 (r v), HOccurs l (r v2), HOccurs l (r v), HDeleteAtLabel * r l1 v1 v', HDeleteAtLabel * r l1 v v2, HDeleteAtLabel * r l v2 v'1, HDeleteAtLabel * r l v v1) => r v -> (l, l1)
- tipyTuple3 :: (HOccurs l2 (r v5), HOccurs l2 (r v2), HOccurs l2 (r v), HOccurs l1 (r v4), HOccurs l1 (r v1), HOccurs l1 (r v), HOccurs l (r v6), HOccurs l (r v3), HOccurs l (r v), HDeleteAtLabel * r l2 v5 v6, HDeleteAtLabel * r l2 v2 v', HDeleteAtLabel * r l2 v v3, HDeleteAtLabel * r l1 v4 v'1, HDeleteAtLabel * r l1 v1 v2, HDeleteAtLabel * r l1 v v5, HDeleteAtLabel * r l v6 v'2, HDeleteAtLabel * r l v3 v4, HDeleteAtLabel * r l v v1) => r v -> (l, l1, l2)
- tipyTuple4 :: (HOccurs l3 (r v11), HOccurs l3 (r v7), HOccurs l3 (r v3), HOccurs l3 (r v), HOccurs l2 (r v10), HOccurs l2 (r v6), HOccurs l2 (r v2), HOccurs l2 (r v), HOccurs l1 (r v9), HOccurs l1 (r v5), HOccurs l1 (r v1), HOccurs l1 (r v), HOccurs l (r v12), HOccurs l (r v8), HOccurs l (r v4), HOccurs l (r v), HDeleteAtLabel * r l3 v11 v12, HDeleteAtLabel * r l3 v7 v8, HDeleteAtLabel * r l3 v3 v', HDeleteAtLabel * r l3 v v4, HDeleteAtLabel * r l2 v10 v11, HDeleteAtLabel * r l2 v6 v'1, HDeleteAtLabel * r l2 v2 v3, HDeleteAtLabel * r l2 v v7, HDeleteAtLabel * r l1 v9 v'2, HDeleteAtLabel * r l1 v5 v6, HDeleteAtLabel * r l1 v1 v2, HDeleteAtLabel * r l1 v v10, HDeleteAtLabel * r l v12 v'3, HDeleteAtLabel * r l v8 v9, HDeleteAtLabel * r l v4 v5, HDeleteAtLabel * r l v v1) => r v -> (l, l1, l2, l3)
- tipyTuple5 :: (HOccurs l4 (r v19), HOccurs l4 (r v14), HOccurs l4 (r v9), HOccurs l4 (r v4), HOccurs l4 (r v), HOccurs l3 (r v18), HOccurs l3 (r v13), HOccurs l3 (r v8), HOccurs l3 (r v3), HOccurs l3 (r v), HOccurs l2 (r v17), HOccurs l2 (r v12), HOccurs l2 (r v7), HOccurs l2 (r v2), HOccurs l2 (r v), HOccurs l1 (r v16), HOccurs l1 (r v11), HOccurs l1 (r v6), HOccurs l1 (r v1), HOccurs l1 (r v), HOccurs l (r v20), HOccurs l (r v15), HOccurs l (r v10), HOccurs l (r v5), HOccurs l (r v), HDeleteAtLabel * r l4 v19 v20, HDeleteAtLabel * r l4 v14 v15, HDeleteAtLabel * r l4 v9 v10, HDeleteAtLabel * r l4 v4 v', HDeleteAtLabel * r l4 v v5, HDeleteAtLabel * r l3 v18 v19, HDeleteAtLabel * r l3 v13 v14, HDeleteAtLabel * r l3 v8 v'1, HDeleteAtLabel * r l3 v3 v4, HDeleteAtLabel * r l3 v v9, HDeleteAtLabel * r l2 v17 v18, HDeleteAtLabel * r l2 v12 v'2, HDeleteAtLabel * r l2 v7 v8, HDeleteAtLabel * r l2 v2 v3, HDeleteAtLabel * r l2 v v13, HDeleteAtLabel * r l1 v16 v'3, HDeleteAtLabel * r l1 v11 v12, HDeleteAtLabel * r l1 v6 v7, HDeleteAtLabel * r l1 v1 v2, HDeleteAtLabel * r l1 v v17, HDeleteAtLabel * r l v20 v'4, HDeleteAtLabel * r l v15 v16, HDeleteAtLabel * r l v10 v11, HDeleteAtLabel * r l v5 v6, HDeleteAtLabel * r l v v1) => r v -> (l, l1, l2, l3, l4)
Documentation
tipyTuple :: (HOccurs l1 (r v1), HOccurs l1 (r v), HOccurs l (r v2), HOccurs l (r v), HDeleteAtLabel * r l1 v1 v', HDeleteAtLabel * r l1 v v2, HDeleteAtLabel * r l v2 v'1, HDeleteAtLabel * r l v v1) => r v -> (l, l1) Source
project a TIP (or HList) into a tuple
tipyTuple' x = (hOccurs
x, hOccurs x)
behaves similarly, except tipyTuple
excludes
the possibility of looking up the same element
twice, which allows inferring a concrete type
in more situations. For example
(\x y z -> tipyTuple (x .*. y .*. emptyTIP) `asTypeOf` (x, z)) () 'x'
has type Char -> ((), Char)
. tipyTuple' would
need a type annotation to decide whether the type
should be Char -> ((), Char)
or () -> ((), ())
tipyTuple3 :: (HOccurs l2 (r v5), HOccurs l2 (r v2), HOccurs l2 (r v), HOccurs l1 (r v4), HOccurs l1 (r v1), HOccurs l1 (r v), HOccurs l (r v6), HOccurs l (r v3), HOccurs l (r v), HDeleteAtLabel * r l2 v5 v6, HDeleteAtLabel * r l2 v2 v', HDeleteAtLabel * r l2 v v3, HDeleteAtLabel * r l1 v4 v'1, HDeleteAtLabel * r l1 v1 v2, HDeleteAtLabel * r l1 v v5, HDeleteAtLabel * r l v6 v'2, HDeleteAtLabel * r l v3 v4, HDeleteAtLabel * r l v v1) => r v -> (l, l1, l2) Source
tipyTuple4 :: (HOccurs l3 (r v11), HOccurs l3 (r v7), HOccurs l3 (r v3), HOccurs l3 (r v), HOccurs l2 (r v10), HOccurs l2 (r v6), HOccurs l2 (r v2), HOccurs l2 (r v), HOccurs l1 (r v9), HOccurs l1 (r v5), HOccurs l1 (r v1), HOccurs l1 (r v), HOccurs l (r v12), HOccurs l (r v8), HOccurs l (r v4), HOccurs l (r v), HDeleteAtLabel * r l3 v11 v12, HDeleteAtLabel * r l3 v7 v8, HDeleteAtLabel * r l3 v3 v', HDeleteAtLabel * r l3 v v4, HDeleteAtLabel * r l2 v10 v11, HDeleteAtLabel * r l2 v6 v'1, HDeleteAtLabel * r l2 v2 v3, HDeleteAtLabel * r l2 v v7, HDeleteAtLabel * r l1 v9 v'2, HDeleteAtLabel * r l1 v5 v6, HDeleteAtLabel * r l1 v1 v2, HDeleteAtLabel * r l1 v v10, HDeleteAtLabel * r l v12 v'3, HDeleteAtLabel * r l v8 v9, HDeleteAtLabel * r l v4 v5, HDeleteAtLabel * r l v v1) => r v -> (l, l1, l2, l3) Source
tipyTuple5 :: (HOccurs l4 (r v19), HOccurs l4 (r v14), HOccurs l4 (r v9), HOccurs l4 (r v4), HOccurs l4 (r v), HOccurs l3 (r v18), HOccurs l3 (r v13), HOccurs l3 (r v8), HOccurs l3 (r v3), HOccurs l3 (r v), HOccurs l2 (r v17), HOccurs l2 (r v12), HOccurs l2 (r v7), HOccurs l2 (r v2), HOccurs l2 (r v), HOccurs l1 (r v16), HOccurs l1 (r v11), HOccurs l1 (r v6), HOccurs l1 (r v1), HOccurs l1 (r v), HOccurs l (r v20), HOccurs l (r v15), HOccurs l (r v10), HOccurs l (r v5), HOccurs l (r v), HDeleteAtLabel * r l4 v19 v20, HDeleteAtLabel * r l4 v14 v15, HDeleteAtLabel * r l4 v9 v10, HDeleteAtLabel * r l4 v4 v', HDeleteAtLabel * r l4 v v5, HDeleteAtLabel * r l3 v18 v19, HDeleteAtLabel * r l3 v13 v14, HDeleteAtLabel * r l3 v8 v'1, HDeleteAtLabel * r l3 v3 v4, HDeleteAtLabel * r l3 v v9, HDeleteAtLabel * r l2 v17 v18, HDeleteAtLabel * r l2 v12 v'2, HDeleteAtLabel * r l2 v7 v8, HDeleteAtLabel * r l2 v2 v3, HDeleteAtLabel * r l2 v v13, HDeleteAtLabel * r l1 v16 v'3, HDeleteAtLabel * r l1 v11 v12, HDeleteAtLabel * r l1 v6 v7, HDeleteAtLabel * r l1 v1 v2, HDeleteAtLabel * r l1 v v17, HDeleteAtLabel * r l v20 v'4, HDeleteAtLabel * r l v15 v16, HDeleteAtLabel * r l v10 v11, HDeleteAtLabel * r l v5 v6, HDeleteAtLabel * r l v v1) => r v -> (l, l1, l2, l3, l4) Source