-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
I have a EDSL with lots of terms that are polymorphic over any Floating type. I wish to perform some abstract interpretation over them looking at properties other than what they do to the numbers (things like signal names and other metadata). Right now I have to pick a Floating type essentially arbitrarily, even though I end up ignoring it.
Since there isn't a Num instance for (), I propose a type like:
data AbstractNumber = AbstractNumber deriving (Eq, Ord)
binop :: AbstractNumber -> AbstractNumber -> AbstractNumber
binop AbstractNumber AbstractNumber = AbstractNumber
instance Num AbstractNumber where
(+) = binop
(*) = binop
negate = id
abs = id
signum = id
fromInteger = const AbstractNumber
-- similarly for Fractional and FloatingIs this a good fit for this package? If so I can draft a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels