| Opt_ImplicitPrelude
| Opt_ScopedTypeVariables
| Opt_BangPatterns
+ | Opt_IndexedTypes
-- optimisation opts
| Opt_Strictness
( "implicit-prelude", Opt_ImplicitPrelude ),
( "scoped-type-variables", Opt_ScopedTypeVariables ),
( "bang-patterns", Opt_BangPatterns ),
+ ( "indexed-types", Opt_IndexedTypes ),
( "monomorphism-restriction", Opt_MonomorphismRestriction ),
( "mono-pat-binds", Opt_MonoPatBinds ),
( "extended-default-rules", Opt_ExtendedDefaultRules ),
Opt_GlasgowExts,
Opt_FFI,
Opt_ImplicitParams,
- Opt_ScopedTypeVariables ]
+ Opt_ScopedTypeVariables,
+ Opt_IndexedTypes ]
isFFlag f = f `elem` (map fst fFlags)
getFFlag f = fromJust (lookup f fFlags)
( "forall", ITforall, bit tvBit),
( "mdo", ITmdo, bit glaExtsBit),
- ( "iso", ITiso, bit glaExtsBit),
- ( "family", ITfamily, bit glaExtsBit),
+ ( "family", ITfamily, bit idxTysBit),
( "foreign", ITforeign, bit ffiBit),
( "export", ITexport, bit ffiBit),
,("-", ITminus, 0)
,("!", ITbang, 0)
- ,("*", ITstar, bit glaExtsBit) -- For data T (a::*) = MkT
- ,(".", ITdot, bit tvBit) -- For 'forall a . t'
+ ,("*", ITstar, bit glaExtsBit .|.
+ bit idxTysBit) -- For data T (a::*) = MkT
+ ,(".", ITdot, bit tvBit) -- For 'forall a . t'
,("-<", ITlarrowtail, bit arrowsBit)
,(">-", ITrarrowtail, bit arrowsBit)
tvBit = 7 -- Scoped type variables enables 'forall' keyword
bangPatBit = 8 -- Tells the parser to understand bang-patterns
-- (doesn't affect the lexer)
+idxTysBit = 9 -- indexed type families: 'family' keyword and kind sigs
glaExtsEnabled, ffiEnabled, parrEnabled :: Int -> Bool
glaExtsEnabled flags = testBit flags glaExtsBit
ipEnabled flags = testBit flags ipBit
tvEnabled flags = testBit flags tvBit
bangPatEnabled flags = testBit flags bangPatBit
+idxTysEnabled flags = testBit flags idxTysBit
-- PState for parsing options pragmas
--
.|. ipBit `setBitIf` dopt Opt_ImplicitParams flags
.|. tvBit `setBitIf` dopt Opt_ScopedTypeVariables flags
.|. bangPatBit `setBitIf` dopt Opt_BangPatterns flags
+ .|. idxTysBit `setBitIf` dopt Opt_IndexedTypes flags
--
setBitIf :: Int -> Bool -> Int
b `setBitIf` cond | cond = bit b
import ListSetOps ( equivClasses, minusList )
import Digraph ( SCC(..) )
import DynFlags ( DynFlag( Opt_GlasgowExts, Opt_Generics,
- Opt_UnboxStrictFields ) )
+ Opt_UnboxStrictFields, Opt_IndexedTypes ) )
\end{code}
recoverM (returnM (Nothing, Nothing)) $
setSrcSpan loc $
tcAddDeclCtxt decl $
- do { -- indexed data types require -fglasgow-exts and can't be in an
+ do { -- indexed data types require -findexed-types and can't be in an
-- hs-boot file
- ; gla_exts <- doptM Opt_GlasgowExts
+ ; gla_exts <- doptM Opt_IndexedTypes
; is_boot <- tcIsHsBoot -- Are we compiling an hs-boot file?
; checkTc gla_exts $ badIdxTyDecl (tcdLName decl)
; checkTc (not is_boot) $ badBootTyIdxDeclErr
(TyFunction {tcdLName = L _ tc_name, tcdTyVars = tvs, tcdKind = kind})
= tcTyVarBndrs tvs $ \ tvs' -> do
{ traceTc (text "type family: " <+> ppr tc_name)
- ; gla_exts <- doptM Opt_GlasgowExts
+ ; gla_exts <- doptM Opt_IndexedTypes
-- Check that we don't use kind signatures without Glasgow extensions
; checkTc gla_exts $ badSigTyDecl tc_name
; let final_tvs = tvs' ++ extra_tvs -- we may not need these
; checkTc (null . unLoc $ ctxt) $ badKindSigCtxt tc_name
- ; gla_exts <- doptM Opt_GlasgowExts
+ ; gla_exts <- doptM Opt_IndexedTypes
-- Check that we don't use kind signatures without Glasgow extensions
; checkTc gla_exts $ badSigTyDecl tc_name