morloc
morloc copied to clipboard
Bad error message when missing top-level signature
In the flu case study of commit d6c2aba3d3e, in the function definition:
plotCladeTree :: FluConfig -> RootedTree Str e (a, Clade) -> ()
plotCladeTree config = plotTree config@treefile . mapLeaf setLeafName
where plotTree, mapLeaf, and setLeafName have the following signatures:
plotTree :: Filename -> RootedTree n Real Str -> ()
setLeafName :: (JsonObj, Sequence) -> Str
mapLeaf :: (l -> l') -> RootedTree n e l -> RootedTree n e l'
Removal of the signature causes the following error to be raised the following error:
morloc: Bug in expressPolyExpr - this should be unreachable
Obviously this case is not unreachable. The type signature ought to be mostly inferrable. The sticky bit is the record FluConfig
. All that can be inferred without that annotation is that some record with the field treefile :: Filename
exists. Currently partially inferred types like this are not supported, so an error should be raised here. This is a user error. The problem is simply that a type annotation is required. The error message should indicate this.