Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

Support DataKinds #54

Closed
wants to merge 2 commits into from
Closed

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
Collaborator

@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 ()
@bmillwood
Copy link
Owner

I'm archiving this repo in favour of haskell-party/haskell-src-meta. I'm a bit unclear on whether this PR is still relevant or whether it's made it to the other upstreams, but hopefully it shouldn't be too painful to move it if necessary?

@bmillwood bmillwood closed this Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants