Skip to content

Allow TypeApplications syntax to be used to instantiate type variables in SPECIALISE pragmas

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,

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,

{-# SPECIALISE foldWithOptionsAndParser @IO #-}
Trac metadata
Trac field Value
Version 8.0.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information