[GHC] #11350: Allow visible type application in patterns
GHC
ghc-devs at haskell.org
Thu Sep 29 03:17:45 UTC 2016
#11350: Allow visible type application in patterns
-------------------------------------+-------------------------------------
Reporter: Iceland_jack | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords:
| TypeApplications PatternSynonyms
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #11385 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Iceland_jack):
Have only referenced this in passing: Allow type application for methods
{{{#!hs
class Semigroup a where
(<>) @a :: a -> a -> a
class Semigroup a => Monoid a where
mempty @a :: a
}}}
and their instances with some #12363
{{{#!hs
instance (Semigroup a, Semigroup b) => Semigroup (a, b) where
(<>) @(a, b) :: (a, b) -> (a, b) -> (a, b)
(a1, b1) <> @(a, b) (a2, b2) = (a1 <> @a a2, b1 <> @b b2)
instance (Monoid a, Monoid b) => Monoid (a, b) where
mempty @(a, b) :: (a, b)
mempty @(a, b) = (mempty @a, mempty @b)
instance Semigroup b => Semigroup (a -> b) where
(<>) @(a -> b) :: (a -> b) -> (a -> b) -> (a -> b)
(f <> @(a -> b) g) x = f x <> @b g x
-- ^ not recommended style
class Monoid b => Monoid (a -> b) where
mempty @(a -> b) :: a -> b
mempty @(a -> b) _ = mempty @b
}}}
The type variables should probably match the order of application a
regular expression context.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11350#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list