1
1
mirror of https://github.com/google/ormolu.git synced 2024-12-11 21:09:47 +03:00

Comma-separated SPECIALIZE types

This commit is contained in:
Vladislav Zavialov 2019-07-12 01:43:58 +03:00 committed by Mark Karpov
parent 984e4b674f
commit fd4fa7f33e
3 changed files with 19 additions and 5 deletions

View File

@ -13,3 +13,12 @@ baz = id
:: Int :: Int
-> Int -> Int
#-} #-}
{-# SPECIALIZE fits13Bits :: Int -> Bool, Integer -> Bool #-}
{-# SPECIALIZE fits13Bits
:: Int
-> Bool
, Integer -> Bool
#-}
fits13Bits :: Integral a => a -> Bool
fits13Bits x = x >= -4096 && x < 4096

View File

@ -14,3 +14,11 @@ baz = id
{-# SPECIALIZE [~2] baz {-# SPECIALIZE [~2] baz
:: Int :: Int
-> Int #-} -> Int #-}
{-# SPECIALIZE fits13Bits :: Int -> Bool, Integer -> Bool #-}
{-# SPECIALIZE fits13Bits
:: Int
-> Bool
, Integer -> Bool #-}
fits13Bits :: Integral a => a -> Bool
fits13Bits x = x >= -4096 && x < 4096

View File

@ -125,10 +125,7 @@ p_specSig name ts InlinePragma {..} = pragmaBraces $ do
breakpoint breakpoint
inci $ do inci $ do
txt ":: " txt ":: "
-- XXX Not at all sure why ts is a list of @LHsSigType GhcPs@ things, it velt (withSep comma (located' p_hsType) (hsib_body <$> ts))
-- appears that we only can give one type to specialize to per pragma.
-- Maybe I'm mistaken.
located (hsib_body (head ts)) p_hsType
p_activation :: Activation -> R () p_activation :: Activation -> R ()
p_activation = \case p_activation = \case