summaryrefslogtreecommitdiff
path: root/progs/prelude/PreludeTuplePrims.hi
blob: 6af0dfdbb8667d5cf33f91b1dca5d173f853b88e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-- This is the interface to the primitives used to implement arbitrary
-- sized tuples.

interface PreludeTuplePrims where

{-# Prelude #-}

-- The type checker fiddles around with the call to dictSel to use the
-- dictionary to resolve the overloading of a subexpression.  The call
-- dictSel (exp dict i) will typecheck exp and use the ith component of
-- the tupleDict dict to resolve the overloading.  No check is made to ensure
-- that the type of the dictionary matches the overloaded class!  Beware!

import PreludeData(Int)

data Tuple
data TupleDicts


tupleSize :: TupleDicts -> Int
tupleSel :: Tuple -> Int -> Int -> a
dictSel :: TupleDicts -> Int -> a
listToTuple :: [a] -> Tuple
-- These are not called by haskell code directly; these are introduced
-- during dictionary conversion by the type checker.
tupleEqDict :: a
tupleOrdDict :: a
tupleIxDict :: a
tupleTextDict :: a
tupleBinaryDict :: a

{-#
tupleSize ::       LispName("prim.tupleSize"), Complexity(1)
tupleSel ::        LispName("prim.tupleSel")
dictSel ::         LispName("prim.dict-sel")
listToTuple ::     LispName("prim.list->tuple"), NoConversion
tupleEqDict ::     LispName("prim.tupleEqDict")
tupleOrdDict ::    LispName("prim.tupleOrdDict")
tupleIxDict ::     LispName("prim.tupleIxDict")
tupleTextDict ::   LispName("prim.tupleTextDict")
tupleBinaryDict :: LispName("prim.tupleBinaryDict")

#-}