[GHC] #15782: Visible type/kind applications in declaration of data/type constructors
GHC
ghc-devs at haskell.org
Fri Oct 19 12:43:32 UTC 2018
#15782: Visible type/kind applications in declaration of data/type constructors
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.6.1
Resolution: | Keywords:
| TypeApplications
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #12045 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by Iceland_jack:
Old description:
> I'm making this ticket to keep track of this, I don't know if it's a good
> idea.
>
> Allow visible type/kind applications when declaring data/type
> constructors on the LHS of `::` (from
> [https://phabricator.haskell.org/D5229#144558 Phab comment]).
>
> {{{#!hs
> data
> Proxy :: forall k. k -> Type where
> MkProxy :: Proxy @k (a :: k)
>
> -- can be written
>
> data
> Proxy @k :: k -> Type where
> MkProxy @k :: Proxy @k (a :: k)
> }}}
>
> &
>
> {{{#!hs
> data
> Fin :: N -> Type where
> FinO :: Fin (S n)
> FinS :: Fin n -> Fin (S n)
>
> -- can be written
>
> data
> Fin :: N -> Type where
> FinO @n :: Fin (S n)
> FinS @n :: Fin n -> Fin (S n)
> }}}
New description:
I'm making this ticket to keep track of this, I don't know if it's a good
idea.
Allow visible type/kind applications when declaring data/type constructors
on the LHS of `::` (from [https://phabricator.haskell.org/D5229#144558
Phab comment]).
{{{#!hs
data
Proxy @k :: k -> Type where
MkProxy @k :: Proxy @k (a :: k)
}}}
&
{{{#!hs
data
Fin :: N -> Type where
FinO @n :: Fin (S n)
FinS @n :: Fin n -> Fin (S n)
}}}
&
{{{#!hs
data
Elem @k @n :: Vec n k -> Type where
ElemO @a @as :: Elem @k @(S n) (a:>as)
ElemS @a @as :: Elem @k @n as
-> Elem @k @(S n) (a:>as)
}}}
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15782#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list