never executed always true always false
    1 module GHC.Tc.Types.Rank (Rank(..))  where
    2 
    3 import GHC.Base (Bool)
    4 import GHC.Utils.Outputable (Outputable, (<+>), parens, ppr, text)
    5 
    6 {-
    7 Note [Higher rank types]
    8 ~~~~~~~~~~~~~~~~~~~~~~~~
    9 Technically
   10             Int -> forall a. a->a
   11 is still a rank-1 type, but it's not Haskell 98 (#5957).  So the
   12 validity checker allow a forall after an arrow only if we allow it
   13 before -- that is, with Rank2Types or RankNTypes
   14 -}
   15 
   16 data Rank = ArbitraryRank -- Any rank ok
   17 
   18           | LimitedRank   -- Note [Higher rank types]
   19                  Bool     -- Forall ok at top
   20                  Rank     -- Use for function arguments
   21 
   22           -- Monotypes that could be a polytype through an extension
   23           | MonoTypeRankZero   -- RankNTypes
   24           | MonoTypeTyConArg   -- ImpredicativeTypes
   25           | MonoTypeSynArg     -- LiberalTypeSynonyms
   26           | MonoTypeConstraint -- QuantifiedConstraints
   27           --
   28 
   29           | MustBeMonoType  -- Monotype regardless of flags
   30 
   31 instance Outputable Rank where
   32   ppr ArbitraryRank      = text "ArbitraryRank"
   33   ppr (LimitedRank top_forall_ok r)
   34                          = text "LimitedRank" <+> ppr top_forall_ok
   35                                               <+> parens (ppr r)
   36   ppr MonoTypeRankZero   = text "MonoTypeRankZero"
   37   ppr MonoTypeTyConArg   = text "MonoTypeTyConArg"
   38   ppr MonoTypeSynArg     = text "MonoTypeSynArg"
   39   ppr MonoTypeConstraint = text "MonoTypeConstraint"
   40   ppr MustBeMonoType     = text "MustBeMonoType"