haskell-src-meta icon indicating copy to clipboard operation
haskell-src-meta copied to clipboard

Support DataKinds

Open roelvandijk opened this issue 9 years ago • 3 comments

Necessary if you want to translate Haskell code using the DataKinds language extension.

Note that a small hack was needed to translate a HSE KindVar to template haskell. HSE does not seem to be able to distinguish between kind variables (such as 'k') and kind constructors (such as 'Nat').

roelvandijk avatar Jan 23 '16 02:01 roelvandijk

@roelvandijk I've taken over the package. This PR is very old and currently has a merge conflict, so I've not attempted to pull it into the new release yet. (Well, I did attempt it, but I ran into issues with ghc complaining about the DataKinds pragma not being there, even though it was there, so I abandoned my efforts for now.) If you'd like to open a fresh PR on the forked repo, please feel free. https://github.com/DanBurton/haskell-src-meta

DanBurton avatar Feb 19 '19 02:02 DanBurton

We just copy+pasted that module into our project: https://github.com/LumiGuide/haskell-opencv/blob/master/doc/Language/Haskell/Meta/Syntax/Translate.hs

It has received some patches in the last 3 years. Feel free to use it for inspiration, or just copy+paste it back into haskell-src-meta.

If I have some free time I could take a look at the differences between both files and maybe make a nice up-to-date pull request.

roelvandijk avatar Feb 19 '19 09:02 roelvandijk

Relevant fix: https://github.com/haskell-party/haskell-src-meta/issues/3#issuecomment-468973951

I found that handling * is not supported, but that's deprecated anyway (see "Remove the * kind syntax" GHC proposal and the -Wstar-is-type warning), and using Type (from Data.Kind) instead of * is supported.

So by simply fixing all -Wstar-is-type warnings, I could make upstream haskell-src-meta work well for LumiGuide's opencv package.


I guess whether to keep this issue open depends on whether you'd like to support the (now-legacy) *syntax for kinds.

nh2 avatar Sep 06 '23 18:09 nh2