Where head is used (in this case on csMainLocals), protected it with a condition so that it gives a more useful error message than simply head: empty list
This commit is contained in:
parent
017cb51bd8
commit
849a41fcdd
1
TLP.hs
1
TLP.hs
|
@ -39,6 +39,7 @@ data TLPChannel = TLPIn | TLPOut | TLPError
|
|||
tlpInterface :: (CSM m, Die m) => m (A.Name, [TLPChannel])
|
||||
tlpInterface
|
||||
= do ps <- get
|
||||
when (null $ csMainLocals ps) (die "No main process found")
|
||||
let mainName = snd $ head $ csMainLocals ps
|
||||
st <- specTypeOfName mainName
|
||||
formals <- case st of
|
||||
|
|
|
@ -29,6 +29,7 @@ import CompState
|
|||
import EvalConstants
|
||||
import Metadata
|
||||
import Pass
|
||||
import Errors
|
||||
import Types
|
||||
|
||||
unnest :: A.Process -> PassM A.Process
|
||||
|
@ -111,6 +112,7 @@ removeFreeNames = doGeneric `extM` doSpecification `extM` doProcess
|
|||
-- we know it's not going to be moved by removeNesting, so anything
|
||||
-- that it had in scope originally will still be in scope.
|
||||
ps <- get
|
||||
when (null $ csMainLocals ps) (die "No main process found")
|
||||
let isTLP = (snd $ head $ csMainLocals ps) == n
|
||||
|
||||
-- Figure out the free names.
|
||||
|
|
Loading…
Reference in New Issue
Block a user