Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overly general type signatures that violate contextual constraints do not raise errors #20

Open
arendsee opened this issue Feb 25, 2024 · 0 comments
Assignees

Comments

@arendsee
Copy link
Collaborator

In the flu case study of commit d6c2aba, 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'

In the top-level signature definition for plotCladeTree, there are two generic types, e and a. However, these types will be inferred to be Real and (JsonObj, Sequence), respectively.

This code does not raise an error, but it probably should. e and a are not really free here, they are constrained to specific types. In Haskell, this code would raise "rigid type value" errors. That is, the general type requested for each variable violates contextual constraints placed on the variables.

@arendsee arendsee self-assigned this Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant