on master help sign in
Update reflection for Float -> Double change
commit42eeb6e51b5319cc6148e3911981622e732146e3 authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateFri 27 Nov 2015, 12:31 (11 years ago) parent99a9eee
4 files changed+15−15
libs/base/Data/Complex.idr+1−1 libs/base/Language/Reflection/Utils.idr+2−2 libs/prelude/Language/Reflection.idr+9−9 src/Idris/Reflection.hs+3−3
libs/base/Data/Complex.idr+1−1
@@ -25,7 +25,7 @@ instance Show a => Show (Complex a) where
2525 plus_i = User 6
2626
2727
28−-- when we have a type class 'Fractional' (which contains Float and Double),
28+-- when we have a type class 'Fractional' (which contains Double),
2929-- we can do:
3030{-
3131instance Fractional a => Fractional (Complex a) where
libs/base/Language/Reflection/Utils.idr+2−2
@@ -129,7 +129,7 @@ instance Show IntTy where
129129
130130instance Show ArithTy where
131131 showPrec d (ATInt t) = showCon d "ATInt" $ showArg t
132− showPrec d ATFloat = "ATFloat"
132+ showPrec d ATDouble = "ATDouble"
133133
134134instance Show Const where
135135 showPrec d (I i) = showCon d "I" $ showArg i
@@ -162,7 +162,7 @@ instance Eq Reflection.IntTy where
162162
163163instance Eq ArithTy where
164164 (ATInt x) == (ATInt y) = x == y
165− ATFloat == ATFloat = True
165+ ATDouble == ATDouble = True
166166 _ == _ = False
167167
168168instance Eq Const where
libs/prelude/Language/Reflection.idr+9−9
@@ -70,10 +70,10 @@ data NativeTy = IT8 | IT16 | IT32 | IT64
7070
7171data IntTy = ITFixed NativeTy | ITNative | ITBig | ITChar
7272
73−data ArithTy = ATInt Language.Reflection.IntTy | ATFloat
73+data ArithTy = ATInt Language.Reflection.IntTy | ATDouble
7474
7575||| Primitive constants
76−data Const = I Int | BI Integer | Fl Float | Ch Char | Str String
76+data Const = I Int | BI Integer | Fl Double | Ch Char | Str String
7777 | B8 Bits8 | B16 Bits16 | B32 Bits32 | B64 Bits64
7878 | AType ArithTy | StrType
7979 | VoidType | Forgot
@@ -89,7 +89,7 @@ instance ReflConst Int where
8989instance ReflConst Integer where
9090 toConst = BI
9191
92−instance ReflConst Float where
92+instance ReflConst Double where
9393 toConst = Fl
9494
9595instance ReflConst Char where
@@ -366,12 +366,12 @@ instance Quotable Int Raw where
366366 quotedTy = `(Int)
367367 quote x = RConstant (I x)
368368
369−instance Quotable Float TT where
370− quotedTy = `(Float)
369+instance Quotable Double TT where
370+ quotedTy = `(Double)
371371 quote x = TConst (Fl x)
372372
373−instance Quotable Float Raw where
374− quotedTy = `(Float)
373+instance Quotable Double Raw where
374+ quotedTy = `(Double)
375375 quote x = RConstant (Fl x)
376376
377377instance Quotable Char TT where
@@ -541,12 +541,12 @@ instance Quotable Reflection.IntTy Raw where
541541instance Quotable ArithTy TT where
542542 quotedTy = `(ArithTy)
543543 quote (ATInt x) = `(ATInt ~(quote x))
544− quote ATFloat = `(ATFloat)
544+ quote ATDouble = `(ATDouble)
545545
546546instance Quotable ArithTy Raw where
547547 quotedTy = `(ArithTy)
548548 quote (ATInt x) = `(ATInt ~(quote {t=Raw} x))
549− quote ATFloat = `(ATFloat)
549+ quote ATDouble = `(ATDouble)
550550
551551instance Quotable Const TT where
552552 quotedTy = `(Const)
src/Idris/Reflection.hs+3−3
@@ -357,8 +357,8 @@ reifyTTConstApp f v@(P _ _ _) =
357357reifyTTConstApp f arg = fail ("Unknown reflection constant: " ++ show (f, arg))
358358
359359reifyArithTy :: Term -> ElabD ArithTy
360−reifyArithTy (App _ (P _ n _) intTy) | n == reflm "ATInt" = fmap ATInt (reifyIntTy intTy)
361−reifyArithTy (P _ n _) | n == reflm "ATFloat" = return ATFloat
360+reifyArithTy (App _ (P _ n _) intTy) | n == reflm "ATInt" = fmap ATInt (reifyIntTy intTy)
361+reifyArithTy (P _ n _) | n == reflm "ATDouble" = return ATFloat
362362reifyArithTy x = fail ("Couldn't reify reflected ArithTy: " ++ show x)
363363
364364reifyNativeTy :: Term -> ElabD NativeTy
@@ -768,7 +768,7 @@ reflectConstant c@(B32 _) = reflCall "B32" [RConstant c]
768768reflectConstant c@(B64 _) = reflCall "B64" [RConstant c]
769769reflectConstant (AType (ATInt ITNative)) = reflCall "AType" [reflCall "ATInt" [Var (reflm "ITNative")]]
770770reflectConstant (AType (ATInt ITBig)) = reflCall "AType" [reflCall "ATInt" [Var (reflm "ITBig")]]
771−reflectConstant (AType ATFloat) = reflCall "AType" [Var (reflm "ATFloat")]
771+reflectConstant (AType ATFloat) = reflCall "AType" [Var (reflm "ATDouble")]
772772reflectConstant (AType (ATInt ITChar)) = reflCall "AType" [reflCall "ATInt" [Var (reflm "ITChar")]]
773773reflectConstant StrType = Var (reflm "StrType")
774774reflectConstant (AType (ATInt (ITFixed IT8))) = reflCall "AType" [reflCall "ATInt" [reflCall "ITFixed" [Var (reflm "IT8")]]]