Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DataKinds #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

roelvandijk
Copy link

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 added a commit to LumiGuide/haskell-opencv that referenced this pull request May 21, 2016
- Removed dependency on custom version of haskell-src-meta
- Can be undone once issue with haskell-src-meta is
  resolved (bmillwood/haskell-src-meta#54)
@DanBurton
Copy link

@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

@roelvandijk
Copy link
Author

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.

nh2 added a commit to nh2/haskell-opencv that referenced this pull request Sep 6, 2023
The main task here is to make `doc-images-opencv` work,
which is this package's way to generate nice documentation images
into the Haddocks, from code that's in the Haddocks.

For that, this commit:

* Deletes copy-pasted + modified module from `haskell-src-meta`,
  `Language.Haskell.Meta.Syntax.Translate`, since as per the commit mentioned in
  * bmillwood/haskell-src-meta#54
  * haskell-party/haskell-src-meta#3 (comment)
  * haskell-party/haskell-src-meta@5c69c3a
  the necessary `DataKinds` changes were merged upstream.
  The commit suggests it's in >= 0.8.3, so that's what's added in the `.cabal` file.

* Replaces all occurrences of `*` by `Type` from `Data.Kind` to fix
  all `-Wstar-is-type` warnings
  (see also https://ghc-proposals.readthedocs.io/en/latest/proposals/0143-remove-star-kind.html).
  This is necessary because the upstream `haskell-src-meta` above
  does not support `*` but does support `Type`; it would print:
      Language.Haskell.Meta.Syntax.Translate.toType: not implemented: TyStar ()
nh2 added a commit to nh2/haskell-opencv that referenced this pull request Sep 6, 2023
The main task here is to make `doc-images-opencv` work,
which is this package's way to generate nice documentation images
into the Haddocks, from code that's in the Haddocks.

For that, this commit:

* Deletes copy-pasted + modified module from `haskell-src-meta`,
  `Language.Haskell.Meta.Syntax.Translate`, since as per the commit mentioned in
  * bmillwood/haskell-src-meta#54
  * haskell-party/haskell-src-meta#3 (comment)
  * haskell-party/haskell-src-meta@5c69c3a
  the necessary `DataKinds` changes were merged upstream.
  The commit suggests it's in >= 0.8.3, so that's what's added in the `.cabal` file.

* Replaces all occurrences of `*` by `Type` from `Data.Kind` to fix
  all `-Wstar-is-type` warnings
  (see also https://ghc-proposals.readthedocs.io/en/latest/proposals/0143-remove-star-kind.html).
  This is necessary because the upstream `haskell-src-meta` above
  does not support `*` but does support `Type`; it would print:
      Language.Haskell.Meta.Syntax.Translate.toType: not implemented: TyStar ()
@nh2
Copy link

nh2 commented Sep 6, 2023

Relevant fix: haskell-party#3 (comment)

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 added a commit to nh2/haskell-opencv that referenced this pull request Sep 6, 2023
The main task here is to make `doc-images-opencv` work,
which is this package's way to generate nice documentation images
into the Haddocks, from code that's in the Haddocks.

For that, this commit:

* Deletes copy-pasted + modified module from `haskell-src-meta`,
  `Language.Haskell.Meta.Syntax.Translate`, since as per the commit mentioned in
  * bmillwood/haskell-src-meta#54
  * haskell-party/haskell-src-meta#3 (comment)
  * haskell-party/haskell-src-meta@5c69c3a
  the necessary `DataKinds` changes were merged upstream.
  The commit suggests it's in >= 0.8.3, so that's what's added in the `.cabal` file.

* Replaces all occurrences of `*` by `Type` from `Data.Kind` to fix
  all `-Wstar-is-type` warnings
  (see also https://ghc-proposals.readthedocs.io/en/latest/proposals/0143-remove-star-kind.html).
  This is necessary because the upstream `haskell-src-meta` above
  does not support `*` but does support `Type`; it would print:
      Language.Haskell.Meta.Syntax.Translate.toType: not implemented: TyStar ()
nh2 added a commit to nh2/haskell-opencv that referenced this pull request Sep 7, 2023
The main task here is to make `doc-images-opencv` work,
which is this package's way to generate nice documentation images
into the Haddocks, from code that's in the Haddocks.

For that, this commit:

* Deletes copy-pasted + modified module from `haskell-src-meta`,
  `Language.Haskell.Meta.Syntax.Translate`, since as per the commit mentioned in
  * bmillwood/haskell-src-meta#54
  * haskell-party/haskell-src-meta#3 (comment)
  * haskell-party/haskell-src-meta@5c69c3a
  the necessary `DataKinds` changes were merged upstream.
  The commit suggests it's in >= 0.8.3, so that's what's added in the `.cabal` file.

* Replaces all occurrences of `*` by `Type` from `Data.Kind` to fix
  all `-Wstar-is-type` warnings
  (see also https://ghc-proposals.readthedocs.io/en/latest/proposals/0143-remove-star-kind.html).
  This is necessary because the upstream `haskell-src-meta` above
  does not support `*` but does support `Type`; it would print:
      Language.Haskell.Meta.Syntax.Translate.toType: not implemented: TyStar ()
nh2 added a commit to nh2/haskell-opencv that referenced this pull request Sep 29, 2023
The main task here is to make `doc-images-opencv` work,
which is this package's way to generate nice documentation images
into the Haddocks, from code that's in the Haddocks.

For that, this commit:

* Deletes copy-pasted + modified module from `haskell-src-meta`,
  `Language.Haskell.Meta.Syntax.Translate`, since as per the commit mentioned in
  * bmillwood/haskell-src-meta#54
  * haskell-party/haskell-src-meta#3 (comment)
  * haskell-party/haskell-src-meta@5c69c3a
  the necessary `DataKinds` changes were merged upstream.
  The commit suggests it's in >= 0.8.3, so that's what's added in the `.cabal` file.

* Replaces all occurrences of `*` by `Type` from `Data.Kind` to fix
  all `-Wstar-is-type` warnings
  (see also https://ghc-proposals.readthedocs.io/en/latest/proposals/0143-remove-star-kind.html).
  This is necessary because the upstream `haskell-src-meta` above
  does not support `*` but does support `Type`; it would print:
      Language.Haskell.Meta.Syntax.Translate.toType: not implemented: TyStar ()
nh2 added a commit to nh2/haskell-opencv that referenced this pull request Sep 29, 2023
The main task here is to make `doc-images-opencv` work,
which is this package's way to generate nice documentation images
into the Haddocks, from code that's in the Haddocks.

For that, this commit:

* Deletes copy-pasted + modified module from `haskell-src-meta`,
  `Language.Haskell.Meta.Syntax.Translate`, since as per the commit mentioned in
  * bmillwood/haskell-src-meta#54
  * haskell-party/haskell-src-meta#3 (comment)
  * haskell-party/haskell-src-meta@5c69c3a
  the necessary `DataKinds` changes were merged upstream.
  The commit suggests it's in >= 0.8.3, so that's what's added in the `.cabal` file.

* Replaces all occurrences of `*` by `Type` from `Data.Kind` to fix
  all `-Wstar-is-type` warnings
  (see also https://ghc-proposals.readthedocs.io/en/latest/proposals/0143-remove-star-kind.html).
  This is necessary because the upstream `haskell-src-meta` above
  does not support `*` but does support `Type`; it would print:
      Language.Haskell.Meta.Syntax.Translate.toType: not implemented: TyStar ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants