Probably this is well known, but I couldn't find an issue on here. Because there's no value restriction on channels in Elm, the type system is unsound (for an appropriate notion of unsoundness) in the usual way. The following incorrect program compiles.
import Signal
import Html
import Html.Attributes(style)
import Html.Events(..)
import Maybe
c = Signal.channel Nothing
s : Signal Int
s = Signal.map (Maybe.withDefault 0) (Signal.subscribe c)
draw x =
Html.div
[ onClick (Signal.send c (Just "I am not an Int"))
, style [("width", "100px"), ("height", "100px")]
]
[ Html.text (toString (x + 1)) ]
|> Html.toElement 100 100
main = Signal.map draw s