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

Type Checking Nothing #819

Open
ebjohnsen opened this issue Jun 9, 2017 · 1 comment
Open

Type Checking Nothing #819

ebjohnsen opened this issue Jun 9, 2017 · 1 comment
Labels

Comments

@ebjohnsen
Copy link

I was experimenting with some code and got the following type error.
I think I am on the head of 'development'. I assume it's an easy fix.

This class compiles and runes fine:
class Main def main() : Maybe[int] if true then Just(5) else Nothing end end end
However, this class produces a type error:
class Main def main() : Maybe[int] if true then Nothing else Nothing end end end

@supercooldave
Copy link

There are simpler problems when using Nothing in a generic situation.

For example, given

fun isJust[a](mval : Maybe[a]) : bool
  match mval with
    case Just(ice) => true 
    case Nothing => false
  end
end

The following requires that [int] is added:

println("{}", isJust[int](Nothing))

The desired code:

println("{}", isJust(Nothing))

does not compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants