[GHC] #12029: Notify user to import * from Data.Kind with TypeInType on
GHC
ghc-devs at haskell.org
Thu Aug 4 02:40:24 UTC 2016
#12029: Notify user to import * from Data.Kind with TypeInType on
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: feature request | Status: new
Priority: lowest | Milestone:
Component: GHCi | Version: 8.1
Resolution: | Keywords: TypeInType
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by johnleo):
The "NB" was added in this patch: https://phabricator.haskell.org/D1610
I don't see a corresponding trac ticket. It seems there was some doubt as
to whether this was the best course.
There are actually a number of inconsistent behaviors with `*` and `★`
which could be addressed. For one thing if you import `*` from Data.Kind
you don't get `★` also which might be confusing since one is supposed to
be the Unicode version of the other, but maybe this is okay.
Another is that you do `:set -fprint-unicode-syntax` then `:k` displays
kinds as `★` whereas `:i` displays kinds as `*`.
The NB for `*` (it works the same way for `★`) only shows up if you have
no other definition for `*` in the kind namespace. So for example if you
define (with `TypeOperators`)
{{{
data (f * g) e = Inl1 (f e) | Inr1 (g e)
data (f ★ g) e = Inl2 (f e) | Inr2 (g e)
}}}
you will now get
{{{
ghci> :k (*)
(*) ∷ ∀ {k}. (k → ★) → (k → ★) → k → ★
ghci> :k (★)
(★) ∷ ∀ {k}. (k → ★) → (k → ★) → k → ★
}}}
with no mention of the missing kind `*` or `★`. If you next import them
you'll get an error for an ambiguous occurrence.
I suppose the NB was added to handle a very specific case in which a naive
user doing nothing sophisticated was trying to find the kind of `*` and
was surprised it didn't exist. Perhaps it would be equally surprising to
find it not showing up with `:i`, but as this is more of a search over all
uses I'd be inclined not to bother adding this special note. In addition
I'd recommend dropping the NB change in 8.2 to make the behaviors
consistent, since the requirement to import `*` from Data.Kind is clearly
documented and people will have had time to absorb the change by then.
However I'm happy to hear other opinions about either of these proposals.
Finally, since `*` and `★` are both deprecated should we not be using
`Type` from 8.2 onward? As in
{{{
ghci> :k (*)
(*) ∷ Type
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12029#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list