7 | interface CharLit (0 a : Type) where
9 | 0 CharPred : Char -> Type
10 | fromChar : (c : Char) -> (0 p : CharPred c) => a
13 | interface DoubleLit (0 a : Type) where
15 | 0 DoublePred : Double -> Type
16 | fromDouble : (d : Double) -> (0 p : DoublePred d) => a
19 | interface IntegerLit (0 a : Type) where
21 | 0 IntegerPred : Integer -> Type
22 | fromInteger : (i : Integer) -> (0 p : IntegerPred i) => a
25 | interface StringLit (0 a : Type) where
27 | 0 StringPred : String -> Type
28 | fromString : (s : String) -> (0 p : StringPred s) => a
30 | public export %inline
31 | Cast Char a => CharLit (Subset a p) where
33 | fromChar c = Element (cast c) %search
35 | public export %inline
36 | Cast Double a => DoubleLit (Subset a p) where
37 | DoublePred = p . cast
38 | fromDouble d = Element (cast d) %search
40 | public export %inline
41 | Cast Integer a => IntegerLit (Subset a p) where
42 | IntegerPred = p . cast
43 | fromInteger i = Element (cast i) %search
45 | public export %inline
46 | Cast String a => StringLit (Subset a p) where
47 | StringPred = p . cast
48 | fromString s = Element (cast s) %search
54 | public export %inline
56 | (p : Integer -> Type)
57 | -> ((i : Integer) -> (0 prf : p i) -> a)
59 | mkIL p f = IL p (\v => f v %search)
61 | public export %inline
63 | (p : String -> Type)
64 | -> ((i : String) -> (0 prf : p i) -> a)
66 | mkSL p f = SL p (\v => f v %search)
68 | public export %inline
71 | -> ((i : Char) -> (0 prf : p i) -> a)
73 | mkCL p f = CL p (\v => f v %search)
75 | public export %inline
77 | (p : Double -> Type)
78 | -> ((i : Double) -> (0 prf : p i) -> a)
80 | mkDL p f = DL p (\v => f v %search)
82 | public export %inline
83 | ilPlain : (Integer -> a) -> IntegerLit a
84 | ilPlain f = IL (const ()) (\v => f v)
86 | public export %inline
87 | clPlain : (Char -> a) -> CharLit a
88 | clPlain f = CL (const ()) (\v => f v)
90 | public export %inline
91 | slPlain : (String -> a) -> StringLit a
92 | slPlain f = SL (const ()) (\v => f v)
94 | public export %inline
95 | dlPlain : (Double -> a) -> DoubleLit a
96 | dlPlain f = DL (const ()) (\v => f v)