coalton
coalton copied to clipboard
Allow matching on other number types
Extend overloaded integer literals to patterns
can someone please add more information as to what this issue is about? thanks
Currently integer literal patterns must be of type Integer
. Ideally it would be possible to pattern match on anything that implements Num
.
This works:
(coalton-toplevel
(define (f x)
(match x
(5 "five")
(_ "not five"))))
This does not:
(coalton-toplevel
(declare f (IFix -> String))
(define (f x)
(match x
(5 "five")
(_ "not five"))))
Thank you.
Ideally it would be possible to pattern match on anything that implements Num.
Num
and Eq
, I would think.
Num
implies Eq