simple-eval

Simply evaluate a string to an integer "1+1" -> 2


Keywords
language, library, program, Propose Tags, Index, Language.Eval, simple-eval-0.1.0.1.tar.gz, browse, Package description, Package maintainers, m, edit package information
License
GPL-2.0-only
Install
cabal install simple-eval-0.1.0.1

Documentation

Language.Eval

Sometimes you just want to evaluate a string

λ :set -XOverloadedStrings
λ import Language.Eval
λ eval "1+1" []
2
λ eval "a+b" [2,3]
5
λ eval "a+b * 100" [2,3]
302
λ eval "a+b * 100 & 0xf" [2,3]
14

There's an example app included:

Eval "1000 & 0xff"

People say that it's okay that Haskell has no eval function because it's easy to write your own. But why bother? Use mine.