What is the best way to model data based on records?
As an algebraic data type with possibly (Haskell) recording components.
A simple example: a JSValue data type representing JSON records.
How can I use a system like Haskell?
Interfaces in Haskell through class classes are a valid approach, although using newtype or another data type rather than exporting its constructors provides equally powerful abstraction properties. Like the use of the existential type type or the generalized algebraic type (GADT).
Example: see, for example, how newtype used in this example .
Example: newtype used to add type safety and abstraction to the PCRE library.
Is this even a good application for Haskell?
Seems to be completely corulent. Strong types, powerful FFI and many libraries in Hackage to help, you have a lot of technology to help get the job done.
Example: There are many database access libraries for Haskell, such as:
and the venerable hdbc , which is also documented in RWH .
And good high-level packages for magically persistent Haskell data .
So, we have a choice and many examples to start with.
source share