-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
module SumTypes.WholeStorySolution exposing (..)
type Silly a b
= AsA a
| AsB b
| AlsoAsA a
| AsInt Int
| AsFloatString Float String
| AsBoth a b
| AsIntB Int b
| AsMaybe (Maybe b)
| AsMaybeInt (Maybe Int)
| DeeplySilly (Silly a a) (Silly Int b)
| NoArg
bVals : Silly a b -> Maybe b
bVals silly =
case silly of
AsB b -> Just b
AsBoth _ b -> Just b
AsIntB _ b -> Just b
AsMaybe (Just b) -> Just b -- could just be AsMaybe maybe -> maybe
DeeplySilly _ nested -> bVals nested -- <--- Problem here
_ -> NothingProduces an error on 0.19:
Detected errors in 1 module.
-- TYPE MISMATCH --------------------------------------------- src/SumTypes/WholeStorySolution.elm
The 1st argument to `bVals` is not what I expect:
171| bVals nested
^^^^^^^^^^
This `nested` value is a:
Silly Int b
But `bVals` needs the 1st argument to be:
Silly a b
Hint: Your type annotation uses type variable `a` which means ANY type of value
can flow through, but your code is saying it specifically wants a `Int` value.
Maybe change your type annotation to be more specific? Maybe change the code to
be more general?
Metadata
Metadata
Assignees
Labels
No labels