Which subset of Haskell is available?

Hi

the documentation (1) seems a bit weak when it comes to DAML language features that come from the Haskell heritage. For example, unless I have missed it, case expressions are not documented. It’s fair to refer to the Haskell documentation for this, but which version of Haskell and which language extensions are supported?

Concretely I would need to use some view patterns or pattern guards. Are those features supported?

Where can I find a list of all Haskell features that I can use in DAML?

Thanks,
Alex

(1) Language reference docs — Daml SDK 1.9.0 documentation

1 Like

We generally try to warn on anything that isn’t supported. View patterns are supported and are even turned on by default. Pattern guards are even enabled in Haskell by default those days and are also enabled and supported in Daml.

An example of unsupported extensions is PatternSynonyms or GADTs.

2 Likes

While likely not complete and someone will have a better answer than me you might also want to take a look at the sections in “An Introduction to Daml”.

And in Chapter 9, while case doesn’t have its own section it does have several examples of where and how it’s used.

2 Likes

For case expressions, take a look at 3 Data types — Daml SDK 1.9.0 documentation for docs.

1 Like

Thanks, @cocreature.

Is there a list somewhere of supported and unsupported language extensions?

1 Like

There is no documented list atm but the source code isn’t too hard to understand if you know Haskell syntax (which you do if you’ve written Daml ;)) daml/Options.hs at 9dc3d2ace40931208c68f79dfc661f4106972560 · digital-asset/daml · GitHub

3 Likes