tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
958 stars 83 forks source link

Importing Type (*) from GHC.TypeLits fails ormolu #520

Closed CarlEdman closed 4 years ago

CarlEdman commented 4 years ago

The issue can be reproduced like this:

% ormolu
import GHC.TypeLits (type (*))
> Parsing of source code failed:
>  <stdin>:1:28
>  parse error on input `*'

Adding the StarIsType language extension explicitly makes no difference:

% ormolu
{-# LANGUAGE StarIsType #-}

import GHC.TypeLits (type (*))
> Parsing of source code failed:
>  <stdin>:3:28
>  parse error on input `*'

This is with the latest public version:

% ormolu --version
> ormolu 0.0.3.1 UNKNOWN UNKNOWN
> using ghc-lib-parser 8.8.2.20200205
mrkkrp commented 4 years ago

Does GHC 8.8.2 still accept * as a valid syntax for Type kind?

CarlEdman commented 4 years ago

Good question. It doesn't look like it does. Or at least I get the same error with 8.8.2:

> ghci
Prelude> import GHC.TypeLits (type (*))
<interactive>:1:28: error: parse error on input ‘*’

But then I get the same error when I try it with ghci 8.6.4/5. And yet the above code appears to compile without complaint under ghc 8.6. And enabling various relevant extensions does not seem to change that result. Nor did I find anything in the release notes that suggested a recent change in this.

However I do appear to be barking up the wrong tree. My apologies.