I'm working through the reflex-frp examples on the github page and got stuck on the Dynamics and Events section. I try to use ghcjs to compile the following code:
{-# LANGUAGE OverloadedStrings #-}
import Reflex
import Reflex.Dom
main = mainWidget $ el "div" $ do
t <- textInput def
text "Last key pressed: "
let keypressEvent = fmap show $ _textInput_keypress t
keypressDyn <- holdDyn "None" keypressEvent
dynText keypressDyn
but I get the error
eventTest.hs:11:13: error:
• Couldn't match type ‘[Char]’ with ‘Data.Text.Internal.Text’
Expected type: Dynamic
(SpiderTimeline Global) Data.Text.Internal.Text
Actual type: Dynamic (SpiderTimeline Global) String
I understand that the String should be parsed instead as Data.Text.Internal.Text, but don't know how to make this happen - I thought the OverloadedStrings statement at the top was supposed to resolve this issue. Does anybody know how to fix this error?