Add a CSE pass to Stg (#9291)
[ghc.git] / compiler / basicTypes / Var.hs
1 {-
2 (c) The University of Glasgow 2006
3 (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
4
5 \section{@Vars@: Variables}
6 -}
7
8 {-# LANGUAGE CPP, MultiWayIf, FlexibleInstances, DeriveDataTypeable #-}
9
10 -- |
11 -- #name_types#
12 -- GHC uses several kinds of name internally:
13 --
14 -- * 'OccName.OccName': see "OccName#name_types"
15 --
16 -- * 'RdrName.RdrName': see "RdrName#name_types"
17 --
18 -- * 'Name.Name': see "Name#name_types"
19 --
20 -- * 'Id.Id': see "Id#name_types"
21 --
22 -- * 'Var.Var' is a synonym for the 'Id.Id' type but it may additionally
23 -- potentially contain type variables, which have a 'TyCoRep.Kind'
24 -- rather than a 'TyCoRep.Type' and only contain some extra
25 -- details during typechecking.
26 --
27 -- These 'Var.Var' names may either be global or local, see "Var#globalvslocal"
28 --
29 -- #globalvslocal#
30 -- Global 'Id's and 'Var's are those that are imported or correspond
31 -- to a data constructor, primitive operation, or record selectors.
32 -- Local 'Id's and 'Var's are those bound within an expression
33 -- (e.g. by a lambda) or at the top level of the module being compiled.
34
35 module Var (
36 -- * The main data type and synonyms
37 Var, CoVar, Id, NcId, DictId, DFunId, EvVar, EqVar, EvId, IpId,
38 TyVar, TypeVar, KindVar, TKVar, TyCoVar,
39
40 -- * In and Out variants
41 InVar, InCoVar, InId, InTyVar,
42 OutVar, OutCoVar, OutId, OutTyVar,
43
44 -- ** Taking 'Var's apart
45 varName, varUnique, varType,
46
47 -- ** Modifying 'Var's
48 setVarName, setVarUnique, setVarType, updateVarType,
49 updateVarTypeM,
50
51 -- ** Constructing, taking apart, modifying 'Id's
52 mkGlobalVar, mkLocalVar, mkExportedLocalVar, mkCoVar,
53 idInfo, idDetails,
54 lazySetIdInfo, setIdDetails, globaliseId,
55 setIdExported, setIdNotExported,
56
57 -- ** Predicates
58 isId, isTyVar, isTcTyVar,
59 isLocalVar, isLocalId, isCoVar, isNonCoVarId, isTyCoVar,
60 isGlobalId, isExportedId,
61 mustHaveLocalBinding,
62
63 -- * TyVar's
64 TyVarBndr(..), ArgFlag(..), TyVarBinder,
65 binderVar, binderVars, binderArgFlag, binderKind,
66 isVisibleArgFlag, isInvisibleArgFlag, sameVis,
67
68 -- ** Constructing TyVar's
69 mkTyVar, mkTcTyVar,
70
71 -- ** Taking 'TyVar's apart
72 tyVarName, tyVarKind, tcTyVarDetails, setTcTyVarDetails,
73
74 -- ** Modifying 'TyVar's
75 setTyVarName, setTyVarUnique, setTyVarKind, updateTyVarKind,
76 updateTyVarKindM,
77
78 nonDetCmpVar
79
80 ) where
81
82 #include "HsVersions.h"
83
84 import {-# SOURCE #-} TyCoRep( Type, Kind, pprKind )
85 import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails, vanillaSkolemTv )
86 import {-# SOURCE #-} IdInfo( IdDetails, IdInfo, coVarDetails, isCoVarDetails, vanillaIdInfo, pprIdDetails )
87
88 import Name hiding (varName)
89 import Unique ( Uniquable, Unique, getKey, getUnique
90 , mkUniqueGrimily, nonDetCmpUnique )
91 import Util
92 import Binary
93 import DynFlags
94 import Outputable
95
96 import Data.Data
97
98 {-
99 ************************************************************************
100 * *
101 Synonyms
102 * *
103 ************************************************************************
104 -- These synonyms are here and not in Id because otherwise we need a very
105 -- large number of SOURCE imports of Id.hs :-(
106 -}
107
108 -- | Identifier
109 type Id = Var -- A term-level identifier
110 -- predicate: isId
111
112 -- | Coercion Variable
113 type CoVar = Id -- See Note [Evidence: EvIds and CoVars]
114 -- predicate: isCoVar
115
116 -- |
117 type NcId = Id -- A term-level (value) variable that is
118 -- /not/ an (unlifted) coercion
119 -- predicate: isNonCoVarId
120
121 -- | Type or kind Variable
122 type TyVar = Var -- Type *or* kind variable (historical)
123
124 -- | Type or Kind Variable
125 type TKVar = Var -- Type *or* kind variable (historical)
126
127 -- | Type Variable
128 type TypeVar = Var -- Definitely a type variable
129
130 -- | Kind Variable
131 type KindVar = Var -- Definitely a kind variable
132 -- See Note [Kind and type variables]
133
134 -- See Note [Evidence: EvIds and CoVars]
135 -- | Evidence Identifier
136 type EvId = Id -- Term-level evidence: DictId, IpId, or EqVar
137
138 -- | Evidence Variable
139 type EvVar = EvId -- ...historical name for EvId
140
141 -- | Dictionary Function Identifier
142 type DFunId = Id -- A dictionary function
143
144 -- | Dictionary Identifier
145 type DictId = EvId -- A dictionary variable
146
147 -- | Implicit parameter Identifier
148 type IpId = EvId -- A term-level implicit parameter
149
150 -- | Equality Variable
151 type EqVar = EvId -- Boxed equality evidence
152
153 -- | Type or Coercion Variable
154 type TyCoVar = Id -- Type, *or* coercion variable
155 -- predicate: isTyCoVar
156
157
158 {- Many passes apply a substitution, and it's very handy to have type
159 synonyms to remind us whether or not the subsitution has been applied -}
160
161 type InVar = Var
162 type InTyVar = TyVar
163 type InCoVar = CoVar
164 type InId = Id
165 type OutVar = Var
166 type OutTyVar = TyVar
167 type OutCoVar = CoVar
168 type OutId = Id
169
170
171
172 {- Note [Evidence: EvIds and CoVars]
173 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
174 * An EvId (evidence Id) is a term-level evidence variable
175 (dictionary, implicit parameter, or equality). Could be boxed or unboxed.
176
177 * DictId, IpId, and EqVar are synonyms when we know what kind of
178 evidence we are talking about. For example, an EqVar has type (t1 ~ t2).
179
180 * A CoVar is always an un-lifted coercion, of type (t1 ~# t2) or (t1 ~R# t2)
181
182 Note [Kind and type variables]
183 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184 Before kind polymorphism, TyVar were used to mean type variables. Now
185 they are use to mean kind *or* type variables. KindVar is used when we
186 know for sure that it is a kind variable. In future, we might want to
187 go over the whole compiler code to use:
188 - TKVar to mean kind or type variables
189 - TypeVar to mean type variables only
190 - KindVar to mean kind variables
191
192
193 ************************************************************************
194 * *
195 \subsection{The main data type declarations}
196 * *
197 ************************************************************************
198
199
200 Every @Var@ has a @Unique@, to uniquify it and for fast comparison, a
201 @Type@, and an @IdInfo@ (non-essential info about it, e.g.,
202 strictness). The essential info about different kinds of @Vars@ is
203 in its @VarDetails@.
204 -}
205
206 -- | Variable
207 --
208 -- Essentially a typed 'Name', that may also contain some additional information
209 -- about the 'Var' and it's use sites.
210 data Var
211 = TyVar { -- Type and kind variables
212 -- see Note [Kind and type variables]
213 varName :: !Name,
214 realUnique :: {-# UNPACK #-} !Int,
215 -- ^ Key for fast comparison
216 -- Identical to the Unique in the name,
217 -- cached here for speed
218 varType :: Kind -- ^ The type or kind of the 'Var' in question
219 }
220
221 | TcTyVar { -- Used only during type inference
222 -- Used for kind variables during
223 -- inference, as well
224 varName :: !Name,
225 realUnique :: {-# UNPACK #-} !Int,
226 varType :: Kind,
227 tc_tv_details :: TcTyVarDetails
228 }
229
230 | Id {
231 varName :: !Name,
232 realUnique :: {-# UNPACK #-} !Int,
233 varType :: Type,
234 idScope :: IdScope,
235 id_details :: IdDetails, -- Stable, doesn't change
236 id_info :: IdInfo } -- Unstable, updated by simplifier
237
238 -- | Identifier Scope
239 data IdScope -- See Note [GlobalId/LocalId]
240 = GlobalId
241 | LocalId ExportFlag
242
243 data ExportFlag -- See Note [ExportFlag on binders]
244 = NotExported -- ^ Not exported: may be discarded as dead code.
245 | Exported -- ^ Exported: kept alive
246
247 {- Note [ExportFlag on binders]
248 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
249 An ExportFlag of "Exported" on a top-level binder says "keep this
250 binding alive; do not drop it as dead code". This transitively
251 keeps alive all the other top-level bindings that this binding refers
252 to. This property is persisted all the way down the pipeline, so that
253 the binding will be compiled all the way to object code, and its
254 symbols will appear in the linker symbol table.
255
256 However, note that this use of "exported" is quite different to the
257 export list on a Haskell module. Setting the ExportFlag on an Id does
258 /not/ mean that if you import the module (in Haskell source code) you
259 will see this Id. Of course, things that appear in the export list
260 of the source Haskell module do indeed have their ExportFlag set.
261 But many other things, such as dictionary functions, are kept alive
262 by having their ExportFlag set, even though they are not exported
263 in the source-code sense.
264
265 We should probably use a different term for ExportFlag, like
266 KeepAlive.
267
268 Note [GlobalId/LocalId]
269 ~~~~~~~~~~~~~~~~~~~~~~~
270 A GlobalId is
271 * always a constant (top-level)
272 * imported, or data constructor, or primop, or record selector
273 * has a Unique that is globally unique across the whole
274 GHC invocation (a single invocation may compile multiple modules)
275 * never treated as a candidate by the free-variable finder;
276 it's a constant!
277
278 A LocalId is
279 * bound within an expression (lambda, case, local let(rec))
280 * or defined at top level in the module being compiled
281 * always treated as a candidate by the free-variable finder
282
283 After CoreTidy, top-level LocalIds are turned into GlobalIds
284 -}
285
286 instance Outputable Var where
287 ppr var = sdocWithDynFlags $ \dflags ->
288 getPprStyle $ \ppr_style ->
289 if | debugStyle ppr_style && (not (gopt Opt_SuppressVarKinds dflags))
290 -> parens (ppr (varName var) <+> ppr_debug var ppr_style <+>
291 dcolon <+> pprKind (tyVarKind var))
292 | otherwise
293 -> ppr (varName var) <> ppr_debug var ppr_style
294
295 ppr_debug :: Var -> PprStyle -> SDoc
296 ppr_debug (TyVar {}) sty
297 | debugStyle sty = brackets (text "tv")
298 ppr_debug (TcTyVar {tc_tv_details = d}) sty
299 | dumpStyle sty || debugStyle sty = brackets (pprTcTyVarDetails d)
300 ppr_debug (Id { idScope = s, id_details = d }) sty
301 | debugStyle sty = brackets (ppr_id_scope s <> pprIdDetails d)
302 ppr_debug _ _ = empty
303
304 ppr_id_scope :: IdScope -> SDoc
305 ppr_id_scope GlobalId = text "gid"
306 ppr_id_scope (LocalId Exported) = text "lidx"
307 ppr_id_scope (LocalId NotExported) = text "lid"
308
309 instance NamedThing Var where
310 getName = varName
311
312 instance Uniquable Var where
313 getUnique = varUnique
314
315 instance Eq Var where
316 a == b = realUnique a == realUnique b
317
318 instance Ord Var where
319 a <= b = realUnique a <= realUnique b
320 a < b = realUnique a < realUnique b
321 a >= b = realUnique a >= realUnique b
322 a > b = realUnique a > realUnique b
323 a `compare` b = a `nonDetCmpVar` b
324
325 -- | Compare Vars by their Uniques.
326 -- This is what Ord Var does, provided here to make it explicit at the
327 -- call-site that it can introduce non-determinism.
328 -- See Note [Unique Determinism]
329 nonDetCmpVar :: Var -> Var -> Ordering
330 nonDetCmpVar a b = varUnique a `nonDetCmpUnique` varUnique b
331
332 instance Data Var where
333 -- don't traverse?
334 toConstr _ = abstractConstr "Var"
335 gunfold _ _ = error "gunfold"
336 dataTypeOf _ = mkNoRepType "Var"
337
338 instance HasOccName Var where
339 occName = nameOccName . varName
340
341 varUnique :: Var -> Unique
342 varUnique var = mkUniqueGrimily (realUnique var)
343
344 setVarUnique :: Var -> Unique -> Var
345 setVarUnique var uniq
346 = var { realUnique = getKey uniq,
347 varName = setNameUnique (varName var) uniq }
348
349 setVarName :: Var -> Name -> Var
350 setVarName var new_name
351 = var { realUnique = getKey (getUnique new_name),
352 varName = new_name }
353
354 setVarType :: Id -> Type -> Id
355 setVarType id ty = id { varType = ty }
356
357 updateVarType :: (Type -> Type) -> Id -> Id
358 updateVarType f id = id { varType = f (varType id) }
359
360 updateVarTypeM :: Monad m => (Type -> m Type) -> Id -> m Id
361 updateVarTypeM f id = do { ty' <- f (varType id)
362 ; return (id { varType = ty' }) }
363
364 {- *********************************************************************
365 * *
366 * ArgFlag
367 * *
368 ********************************************************************* -}
369
370 -- | Argument Flag
371 --
372 -- Is something required to appear in source Haskell ('Required'),
373 -- permitted by request ('Specified') (visible type application), or
374 -- prohibited entirely from appearing in source Haskell ('Inferred')?
375 -- See Note [TyBinders and ArgFlags] in TyCoRep
376 data ArgFlag = Required | Specified | Inferred
377 deriving (Eq, Data)
378
379 -- | Does this 'ArgFlag' classify an argument that is written in Haskell?
380 isVisibleArgFlag :: ArgFlag -> Bool
381 isVisibleArgFlag Required = True
382 isVisibleArgFlag _ = False
383
384 -- | Does this 'ArgFlag' classify an argument that is not written in Haskell?
385 isInvisibleArgFlag :: ArgFlag -> Bool
386 isInvisibleArgFlag = not . isVisibleArgFlag
387
388 -- | Do these denote the same level of visibility? 'Required'
389 -- arguments are visible, others are not. So this function
390 -- equates 'Specified' and 'Inferred'. Used for printing.
391 sameVis :: ArgFlag -> ArgFlag -> Bool
392 sameVis Required Required = True
393 sameVis Required _ = False
394 sameVis _ Required = False
395 sameVis _ _ = True
396
397 {- *********************************************************************
398 * *
399 * TyVarBndr, TyVarBinder
400 * *
401 ********************************************************************* -}
402
403 -- Type Variable Binder
404 --
405 -- TyVarBndr is polymorphic in both tyvar and visiblity fields:
406 -- * tyvar can be TyVar or IfaceTv
407 -- * argf can be ArgFlag or TyConBndrVis
408 data TyVarBndr tyvar argf = TvBndr tyvar argf
409 deriving( Data )
410
411 -- | Type Variable Binder
412 --
413 -- A 'TyVarBinder' is the binder of a ForAllTy
414 -- It's convenient to define this synonym here rather its natural
415 -- home in TyCoRep, because it's used in DataCon.hs-boot
416 type TyVarBinder = TyVarBndr TyVar ArgFlag
417
418 binderVar :: TyVarBndr tv argf -> tv
419 binderVar (TvBndr v _) = v
420
421 binderVars :: [TyVarBndr tv argf] -> [tv]
422 binderVars tvbs = map binderVar tvbs
423
424 binderArgFlag :: TyVarBndr tv argf -> argf
425 binderArgFlag (TvBndr _ argf) = argf
426
427 binderKind :: TyVarBndr TyVar argf -> Kind
428 binderKind (TvBndr tv _) = tyVarKind tv
429
430 {-
431 ************************************************************************
432 * *
433 * Type and kind variables *
434 * *
435 ************************************************************************
436 -}
437
438 tyVarName :: TyVar -> Name
439 tyVarName = varName
440
441 tyVarKind :: TyVar -> Kind
442 tyVarKind = varType
443
444 setTyVarUnique :: TyVar -> Unique -> TyVar
445 setTyVarUnique = setVarUnique
446
447 setTyVarName :: TyVar -> Name -> TyVar
448 setTyVarName = setVarName
449
450 setTyVarKind :: TyVar -> Kind -> TyVar
451 setTyVarKind tv k = tv {varType = k}
452
453 updateTyVarKind :: (Kind -> Kind) -> TyVar -> TyVar
454 updateTyVarKind update tv = tv {varType = update (tyVarKind tv)}
455
456 updateTyVarKindM :: (Monad m) => (Kind -> m Kind) -> TyVar -> m TyVar
457 updateTyVarKindM update tv
458 = do { k' <- update (tyVarKind tv)
459 ; return $ tv {varType = k'} }
460
461 mkTyVar :: Name -> Kind -> TyVar
462 mkTyVar name kind = TyVar { varName = name
463 , realUnique = getKey (nameUnique name)
464 , varType = kind
465 }
466
467 mkTcTyVar :: Name -> Kind -> TcTyVarDetails -> TyVar
468 mkTcTyVar name kind details
469 = -- NB: 'kind' may be a coercion kind; cf, 'TcMType.newMetaCoVar'
470 TcTyVar { varName = name,
471 realUnique = getKey (nameUnique name),
472 varType = kind,
473 tc_tv_details = details
474 }
475
476 tcTyVarDetails :: TyVar -> TcTyVarDetails
477 -- See Note [TcTyVars in the typechecker] in TcType
478 tcTyVarDetails (TcTyVar { tc_tv_details = details }) = details
479 tcTyVarDetails (TyVar {}) = vanillaSkolemTv
480 tcTyVarDetails var = pprPanic "tcTyVarDetails" (ppr var <+> dcolon <+> pprKind (tyVarKind var))
481
482 setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar
483 setTcTyVarDetails tv details = tv { tc_tv_details = details }
484
485 -------------------------------------
486 instance Outputable tv => Outputable (TyVarBndr tv ArgFlag) where
487 ppr (TvBndr v Required) = ppr v
488 ppr (TvBndr v Specified) = char '@' <> ppr v
489 ppr (TvBndr v Inferred) = braces (ppr v)
490
491 instance Outputable ArgFlag where
492 ppr Required = text "[req]"
493 ppr Specified = text "[spec]"
494 ppr Inferred = text "[infrd]"
495
496 instance (Binary tv, Binary vis) => Binary (TyVarBndr tv vis) where
497 put_ bh (TvBndr tv vis) = do { put_ bh tv; put_ bh vis }
498
499 get bh = do { tv <- get bh; vis <- get bh; return (TvBndr tv vis) }
500
501
502 instance Binary ArgFlag where
503 put_ bh Required = putByte bh 0
504 put_ bh Specified = putByte bh 1
505 put_ bh Inferred = putByte bh 2
506
507 get bh = do
508 h <- getByte bh
509 case h of
510 0 -> return Required
511 1 -> return Specified
512 _ -> return Inferred
513
514 {-
515 %************************************************************************
516 %* *
517 \subsection{Ids}
518 * *
519 ************************************************************************
520 -}
521
522 idInfo :: Id -> IdInfo
523 idInfo (Id { id_info = info }) = info
524 idInfo other = pprPanic "idInfo" (ppr other)
525
526 idDetails :: Id -> IdDetails
527 idDetails (Id { id_details = details }) = details
528 idDetails other = pprPanic "idDetails" (ppr other)
529
530 -- The next three have a 'Var' suffix even though they always build
531 -- Ids, because Id.hs uses 'mkGlobalId' etc with different types
532 mkGlobalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
533 mkGlobalVar details name ty info
534 = mk_id name ty GlobalId details info
535
536 mkLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
537 mkLocalVar details name ty info
538 = mk_id name ty (LocalId NotExported) details info
539
540 mkCoVar :: Name -> Type -> CoVar
541 -- Coercion variables have no IdInfo
542 mkCoVar name ty = mk_id name ty (LocalId NotExported) coVarDetails vanillaIdInfo
543
544 -- | Exported 'Var's will not be removed as dead code
545 mkExportedLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
546 mkExportedLocalVar details name ty info
547 = mk_id name ty (LocalId Exported) details info
548
549 mk_id :: Name -> Type -> IdScope -> IdDetails -> IdInfo -> Id
550 mk_id name ty scope details info
551 = Id { varName = name,
552 realUnique = getKey (nameUnique name),
553 varType = ty,
554 idScope = scope,
555 id_details = details,
556 id_info = info }
557
558 -------------------
559 lazySetIdInfo :: Id -> IdInfo -> Var
560 lazySetIdInfo id info = id { id_info = info }
561
562 setIdDetails :: Id -> IdDetails -> Id
563 setIdDetails id details = id { id_details = details }
564
565 globaliseId :: Id -> Id
566 -- ^ If it's a local, make it global
567 globaliseId id = id { idScope = GlobalId }
568
569 setIdExported :: Id -> Id
570 -- ^ Exports the given local 'Id'. Can also be called on global 'Id's, such as data constructors
571 -- and class operations, which are born as global 'Id's and automatically exported
572 setIdExported id@(Id { idScope = LocalId {} }) = id { idScope = LocalId Exported }
573 setIdExported id@(Id { idScope = GlobalId }) = id
574 setIdExported tv = pprPanic "setIdExported" (ppr tv)
575
576 setIdNotExported :: Id -> Id
577 -- ^ We can only do this to LocalIds
578 setIdNotExported id = ASSERT( isLocalId id )
579 id { idScope = LocalId NotExported }
580
581 {-
582 ************************************************************************
583 * *
584 \subsection{Predicates over variables}
585 * *
586 ************************************************************************
587 -}
588
589 isTyVar :: Var -> Bool -- True of both TyVar and TcTyVar
590 isTyVar (TyVar {}) = True
591 isTyVar (TcTyVar {}) = True
592 isTyVar _ = False
593
594 isTcTyVar :: Var -> Bool -- True of TcTyVar only
595 isTcTyVar (TcTyVar {}) = True
596 isTcTyVar _ = False
597
598 isTyCoVar :: Var -> Bool
599 isTyCoVar v = isTyVar v || isCoVar v
600
601 isId :: Var -> Bool
602 isId (Id {}) = True
603 isId _ = False
604
605 isCoVar :: Var -> Bool
606 -- A coercion variable
607 isCoVar (Id { id_details = details }) = isCoVarDetails details
608 isCoVar _ = False
609
610 isNonCoVarId :: Var -> Bool
611 -- A term variable (Id) that is /not/ a coercion variable
612 isNonCoVarId (Id { id_details = details }) = not (isCoVarDetails details)
613 isNonCoVarId _ = False
614
615 isLocalId :: Var -> Bool
616 isLocalId (Id { idScope = LocalId _ }) = True
617 isLocalId _ = False
618
619 -- | 'isLocalVar' returns @True@ for type variables as well as local 'Id's
620 -- These are the variables that we need to pay attention to when finding free
621 -- variables, or doing dependency analysis.
622 isLocalVar :: Var -> Bool
623 isLocalVar v = not (isGlobalId v)
624
625 isGlobalId :: Var -> Bool
626 isGlobalId (Id { idScope = GlobalId }) = True
627 isGlobalId _ = False
628
629 -- | 'mustHaveLocalBinding' returns @True@ of 'Id's and 'TyVar's
630 -- that must have a binding in this module. The converse
631 -- is not quite right: there are some global 'Id's that must have
632 -- bindings, such as record selectors. But that doesn't matter,
633 -- because it's only used for assertions
634 mustHaveLocalBinding :: Var -> Bool
635 mustHaveLocalBinding var = isLocalVar var
636
637 -- | 'isExportedIdVar' means \"don't throw this away\"
638 isExportedId :: Var -> Bool
639 isExportedId (Id { idScope = GlobalId }) = True
640 isExportedId (Id { idScope = LocalId Exported}) = True
641 isExportedId _ = False