Есть ли способ сериализации (чтение/показ) функций в Haskell?
Например, при условии, что:
:t (+1)
(+1) :: Num a => a -> a
Я хочу иметь что-то вроде:
read "(+1)" :: Num a => a -> a
К сожалению, это вызывает ошибку:
Could not deduce (Read (a -> a)) arising from a use of `read'
from the context (Num a)
bound by an expression type signature: Num a => a -> a
at <interactive>:1:1-30
Possible fix:
add (Read (a -> a)) to the context of
an expression type signature: Num a => a -> a
or add an instance declaration for (Read (a -> a))
In the expression: read "(+1)" :: Num a => a -> a
In an equation for `it': it = read "(+1)" :: Num a => a -> a