write js typesafe using haskell