Skip to content
CCPEDIAby Unity Nodes
App Development

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

7 posts748 views2 likesLast activity Nov 2020

  1. LucianoOP 1

    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?

  2. cocreature

    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?

  3. Luciano

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

  4. cocreature

    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.

  5. Luciano

    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

  6. cocreature

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

    {-# LANGUAGE TypeOperators #-}
    module Main where