0

Is there a way to specify partial custom types in type annotations?

For instance, if I have my type aliases this way: func : { a | foo : String } can I have this function:

when : Bool -> msg -> msg -> msg
when ok msgTrue msgFalse = 
    if ok then 
        msgTrue 
    else 
        msgFalse

and I would like to do something like this:

when : Bool -> (msg | NoOp) -> msg
when ok msg = 
    if ok then
        msg 
    else
        NoOp  

where we know msg has at least NoOp value

4

0 回答 0