Skip to content
Discussions/App Development/How to make damlc ide parse {-# LANGUAGE -#}?Forum ↗

How to make damlc ide parse {-# LANGUAGE -#}?

App Development7 posts702 views2 likesLast activity Nov 2020
LU
LucianoOP
Nov 2020

When I run daml damlc ide to use the LSP server with vim, I need to pass it explicit arguments --ghc-option -X_____ to enable a language feature.

Is there a way to automate this, so that the LSP server infers these from the {-# LANGAUGE _____ #-} pragma in my source code, rather than having to pass them in explicitly?

CO
cocreature
Nov 2020

damlc should always parse that pragma both in the IDE mode as well as in daml build. Do you have a concrete example where this doesn’t work?

LU
Luciano
Nov 2020

It happens every time I start the IDE from vim. It executes daml damlc ide indirectly, as far as I know.

CO
cocreature
Nov 2020

Can you reproduce it in VSCode? All the logic for this should be in damlc not in the editor-specific side so it shouldn’t be specific to vim.

LU
Luciano
Nov 2020

Looks like I can reproduce it:

image

Just ran daml init and then created daml/Main.daml like above. The error says

/home/luciano/src/testextensions/daml/Main.daml:5:6: error:
Illegal declaration of a type or class operator ‘:+:’
Use TypeOperators to declare operators in type and declarations

CO
cocreature
Nov 2020

The lanugage pragma needs to be above the module header not below. So try the following:

{-# LANGUAGE TypeOperators #-}
module Main where
← Back to Discussions