@hackage hs2ps0.1.3.0
Translate Haskell types to PureScript
Installation
Dependencies (2)
- base >=4.7 && <5
- template-haskell >=2.14.0.0 && <3 Show all…
Dependents (0)
h2ps-types
Example:
-- translate/Main.hs
module Main where
import Prelude
import Type.HS2PS (renderPSTypes)
main :: IO ()
main = do
let ts :: String
ts = $(renderPSTypes
[ ''Maybe
, ''Either
] )
let moduleName = "ImportedTypes"
writeFile ("purs/src/" <> moduleName <> ".purs") $
"module " <> moduleName <> " where\n\n" <> ts
module ImportedTypes where
data Maybe a = Nothing | Just a
data Either a b = Left a | Right b
# package.yaml
executables:
translate-types:
main: Main.hs
source-dirs: translate
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- <package-name>
- hs2ps
when:
- condition: flag(library-only)
buildable: false