Skip to content

Commit

Permalink
Casting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee Pike committed Nov 5, 2011
1 parent 7eb2b9d commit 25df4bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Copilot/Core/Interpret/Eval.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ evalOp1 op = case op of
Atanh _ -> P.atanh Atanh _ -> P.atanh
Acosh _ -> P.acosh Acosh _ -> P.acosh
BwNot _ -> complement BwNot _ -> complement
Cast _ _ -> P.fromIntegral


-------------------------------------------------------------------------------- --------------------------------------------------------------------------------


Expand Down
4 changes: 3 additions & 1 deletion src/Copilot/Core/Operators.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ data Op1 a b where
Asinh :: Floating a => Type a -> Op1 a a Asinh :: Floating a => Type a -> Op1 a a
Atanh :: Floating a => Type a -> Op1 a a Atanh :: Floating a => Type a -> Op1 a a
Acosh :: Floating a => Type a -> Op1 a a Acosh :: Floating a => Type a -> Op1 a a
-- Bitwise operators: -- Bitwise operators.
BwNot :: Bits a => Type a -> Op1 a a BwNot :: Bits a => Type a -> Op1 a a
-- Casting operaators.
Cast :: (Integral a, Num b) => Type a -> Type b -> Op1 a b


-- | Binary operators. -- | Binary operators.
data Op2 a b c where data Op2 a b c where
Expand Down
1 change: 1 addition & 0 deletions src/Copilot/Core/PrettyPrint.hs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ppOp1 op = case op of
Atanh _ -> ppPrefix "atanh" Atanh _ -> ppPrefix "atanh"
Acosh _ -> ppPrefix "acosh" Acosh _ -> ppPrefix "acosh"
BwNot _ -> ppPrefix "~" BwNot _ -> ppPrefix "~"
Cast _ _ -> ppPrefix "(cast)"


ppOp2 :: Op2 a b c -> Doc -> Doc -> Doc ppOp2 :: Op2 a b c -> Doc -> Doc -> Doc
ppOp2 op = case op of ppOp2 op = case op of
Expand Down

0 comments on commit 25df4bf

Please sign in to comment.