Skip to content
Haskell module to help writing closure compiler type definition, from one type definition, provide export and ToJSON instance
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Closure External Producer

Typing all the way down.

When creating a web service using Json message, it is useful to use the "Google Closure Compiler" to validate the client side javascript. Type verification in the closure compiler require type definitions known as externs.

When coding in haskell, all the types are already there, so let's try to use the compiler to provide the type definitions for us, or at least, help us in this task.


The Aeson library provide an useful typeclass to serialize to JSON data. The ideal solution is to provide one description for the typing and the serialization.

The trick is that the typing language is richer than the serializable one, for instance JSON cannot serialize function nor tuples, thus need to be excluded of serialization capability.

Something went wrong with that request. Please try again.