Skip to content

Commit

Permalink
extend case of exponentiation, but make failure be a pattern match is…
Browse files Browse the repository at this point in the history
…sues for now
  • Loading branch information
dorchard committed Sep 16, 2024
1 parent d146080 commit f0c07b3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Language/Fortran/Repr/Eval/Value.hs
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,12 @@ evalBOp bop l r = do
(FSVInt li, FSVInt ri) ->
pure $ MkFScalarValue $ FSVInt $ fIntBOpInplace (^) li ri
(FSVReal lr, FSVReal ri) ->
pure $ MkFScalarValue $ FSVReal $ fRealBOpInplace' exp exp lr ri
where
exp x y = x ** y
_ -> err $ ELazy "exponentiation: unsupported types"
pure $ MkFScalarValue $ FSVReal $ fRealBOpInplace' (**) (**) lr ri
(FSVReal lr, FSVInt ri) ->
-- Handle case of a real raised to an integer power.
pure $ MkFScalarValue $ FSVReal $ fRealBOpInplace' (**) (**) lr (FReal8 $ withFInt ri)

-- _ -> err $ ELazy "exponentiation: unsupported types"

F.Concatenation ->
case (l', r') of
Expand Down

0 comments on commit f0c07b3

Please sign in to comment.