What?
An ML-language that compiles to TypeScript or JavaScript, with types.
import "./String" as String
type alias Person = {
name: string,
age: number
}
sayHi: Person -> string
sayHi person =
"Hello, " + person.name
type Animal =
Dog { name: string }
| Cat { lives: number }
sayHiToAnimal: Animal -> string
sayHiToAnimal animal =
case animal of
Dog { name } -> "Who is a good boy? " + name + " is!"
Cat { lives } -> "You have " + (String.fromNumber lives) + " lives remaining"
Why?
You're writing TypeScript, but miss the simplicity of Elm. Taking a types-first approach requires a lot of boilerplate or magical libraries. Writing tsx with React feels wrong. Luckily, Derw is there for you. With interop for TypeScript, Derw allows you to work on your existing codebases and projects in a simpler manner than Elm, while providing you with familiar libraries like the Html package built on the model-view-update structure.
Read the announcement blogpost for more info on why
How?
Derw compiles to TypeScript, generating type-safe code. It has a type system to verify that Derw code is correctly typed. Through generating TypeScript it is possible to ensure that interop code between Derw and TypeScript is typesafe.