summaryrefslogtreecommitdiff
path: root/src/Language/AST.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Language/AST.hs')
-rw-r--r--src/Language/AST.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Language/AST.hs b/src/Language/AST.hs
index 0ed4e51..8c91d59 100644
--- a/src/Language/AST.hs
+++ b/src/Language/AST.hs
@@ -98,6 +98,27 @@ instance (t ~ TScal st, ScalIsNumeric st ~ True, KnownScalTy st, Num (ScalRep st
in case scalRepIsShow ty of
Dict -> NEConst ty . fromInteger
+instance (t ~ TScal st, ScalIsNumeric st ~ True, ScalIsFloating st ~ True, KnownScalTy st, Fractional (ScalRep st))
+ => Fractional (NExpr env t) where
+ recip e = NEOp (ORecip knownScalTy) e
+ fromRational =
+ let ty = knownScalTy
+ in case scalRepIsShow ty of
+ Dict -> NEConst ty . fromRational
+
+instance (t ~ TScal st, ScalIsNumeric st ~ True, ScalIsFloating st ~ True, KnownScalTy st, Floating (ScalRep st))
+ => Floating (NExpr env t) where
+ pi =
+ let ty = knownScalTy
+ in case scalRepIsShow ty of
+ Dict -> NEConst ty pi
+ exp = NEOp (OExp knownScalTy)
+ log = NEOp (OExp knownScalTy)
+ sin = undefined ; cos = undefined ; tan = undefined
+ asin = undefined ; acos = undefined ; atan = undefined
+ sinh = undefined ; cosh = undefined
+ asinh = undefined ; acosh = undefined ; atanh = undefined
+
instance (KnownTy t, KnownSymbol name, name ~ n') => IsLabel name (Var n' t) where
fromLabel = Var symbolSing knownTy