Dhall-haskell: Text editor integration?

Created on 14 Aug 2017  Â·  5Comments  Â·  Source: dhall-lang/dhall-haskell

I'm wondering your thoughts on what widespread Dhall usage might look like.

  • Should Dhall files have a common file extension? I've just been using .txt; I suppose one might reasonably consider .hs or .dhall.
  • How might syntax highlighting in text editors work? Should any Haskell syntax highlighter suffice for Dhall, or would we be better off creating Dhall plugins for various editors?

Most helpful comment

Yeah, I think there should be a common file extension. My intuition is to just pick .dhall since I'd rather err on the side of the extension being clear than try to save characters

Haskell highlighters usually work okay for Dhall code. For example, here is how GitHub renders Prelude/List/concat using the Haskell syntax highlighter:

{-
Concatenate a `List` of `List`s into a single `List`

Examples:

./concat Integer
(   [   [0, 1, 2]    : List Integer
    ,   [3, 4]       : List Integer
    ,   [5, 6, 7, 8] : List Integer
    ]   : List (List Integer)
)
= [0, 1, 2, 3, 4, 5, 6, 7, 8] : List Integer

./concat Integer
(   [   [] : List Integer
    ,   [] : List Integer
    ,   [] : List Integer
    ]   : List (List Integer)
)
= [] : List Integer

./concat Integer ([] : List (List Integer)) = [] : List Integer
-}
let concat : ∀(a : Type) → List (List a) → List a
    =   λ(a : Type)
    →   λ(xss : List (List a))
    →   List/build
        a
        (   λ(list : Type)
        →   λ(cons : a → list → list)
        →   λ(nil : list)
        →   List/fold
            (List a)
            xss
            list
            (   λ(xs : List a)
            →   λ(ys : list)
            →   List/fold
                a
                xs
                list
                cons
                ys
            )
            nil
        )

in  concat

However, it obviously can't hurt to have a Dhall-specific highlighter

All 5 comments

Yeah, I think there should be a common file extension. My intuition is to just pick .dhall since I'd rather err on the side of the extension being clear than try to save characters

Haskell highlighters usually work okay for Dhall code. For example, here is how GitHub renders Prelude/List/concat using the Haskell syntax highlighter:

{-
Concatenate a `List` of `List`s into a single `List`

Examples:

./concat Integer
(   [   [0, 1, 2]    : List Integer
    ,   [3, 4]       : List Integer
    ,   [5, 6, 7, 8] : List Integer
    ]   : List (List Integer)
)
= [0, 1, 2, 3, 4, 5, 6, 7, 8] : List Integer

./concat Integer
(   [   [] : List Integer
    ,   [] : List Integer
    ,   [] : List Integer
    ]   : List (List Integer)
)
= [] : List Integer

./concat Integer ([] : List (List Integer)) = [] : List Integer
-}
let concat : ∀(a : Type) → List (List a) → List a
    =   λ(a : Type)
    →   λ(xss : List (List a))
    →   List/build
        a
        (   λ(list : Type)
        →   λ(cons : a → list → list)
        →   λ(nil : list)
        →   List/fold
            (List a)
            xss
            list
            (   λ(xs : List a)
            →   λ(ys : list)
            →   List/fold
                a
                xs
                list
                cons
                ys
            )
            nil
        )

in  concat

However, it obviously can't hurt to have a Dhall-specific highlighter

Do you have any interest in hosting Dhall-related tooling either here or in another repository, or should those projects just be separate?

They should probably be separate projects, and I will create a dhall organization soon to group all of these projects

The main scope of this project is (A) to provide Haskell bindings to Dhall (thus the project name) and (B) to provide a Haskell implementation of the dhall command-line compiler. I think it's good practice for each eventual language binding to implement such a compiler to avoid any specific implementation becoming a de-facto language standard and to also provide a starting template for people to customize the compiler in their language of choice if necessary

This project also has a third function of hosting the Dhall Prelude, but that could easily be split out into a separate repository since there's no specific benefit to bundling it with this project

Once there is a dhall organization, this project would no longer be distinguished among projects and there would probably be a separate repository to track project-level issues and provide an overview of the Dhall ecosystem (similar to the ipfs/ipfs repository's role for the ipfs organization)

Cool, thanks for explaining. I don't know whether you want to leave this issue open, but as far as I'm concerned, my questions are answered.

You're welcome!

Was this page helpful?
0 / 5 - 0 ratings