Equivalent of python eval in Haskell

后端 未结 5 675
闹比i
闹比i 2021-02-05 20:21

There is function in python called eval that takes string input and evaluates it.

>>> x = 1
>>> print eval(\'x+1\')
2
>>>         


        
5条回答
  •  生来不讨喜
    2021-02-05 20:35

    It doesn't have an inbuilt eval function. However are some packages on hackage that can do the same sort of thing. (docs). Thanks to @luqui there is also hint.

提交回复
热议问题