[GHC] #12649: Allow TypeApplications syntax to be used to instantiate type variables in SPECIALISE pragmas
GHC
ghc-devs at haskell.org
Fri Sep 30 20:28:47 UTC 2016
#12649: Allow TypeApplications syntax to be used to instantiate type variables in
SPECIALISE pragmas
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner:
Type: feature | Status: new
request |
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Currently the `SPECIALISE` pragma requires that the user repeat the entire
type of a binding to instantiate its types. This is often needlessly
verbose and quite tiresome. Instead, why not allow the user to write the
desired type as an application with `TypeApplications`?
For instance, currently we might write,
{{{#!hs
foldWithOptionsAndParser :: forall m params. ( MonadIO m, MonadMask m,
ToRow params )
=> FoldOptions
-> RowParser row
-> Connection
-> Query
-> params
-> a
-> (a -> row -> m a)
-> m a
foldWithOptionsAndParser opts parser conn template qs a f = ...
{-# SPECIALISE
foldWithOptionsAndParser :: FoldOptions -> RowParser row -> Connection
-> Query -> params -> a
-> (a -> row -> IO a) -> IO a #-}
}}}
Instead we might want to write,
{{{#!hs
{-# SPECIALISE foldWithOptionsAndParser @IO #-}
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12649>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list