You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to write a calculation (a *. b) *. c where a :: A, b :: B and c :: C.
I defined instances MultiplicativeAction A B and MultiplicativeAction A C. Now a *. b :: A and denote that with a', and a' *. c :: A, the types seem to match up. However, now I get the error Functional dependencies conflict between instance declarations (as they do).
There's surely a reason why the fundep is there, but I couldn't find the reason in the Haddocks, the code or the Git history. Could you open this up a bit?
The text was updated successfully, but these errors were encountered:
The main reason for fundeps was to avoid TypeFamilies. There has, at least historically, been a reluctance to introduce type families to Prelude due to various performance issues that I think remain unresolved to date eg
Back in the day, numhask mirrored this conservatism in a naive attempt for a Num redesign to get taken seriously.
The typefam branch includes a switch to TypeFamilies for a MultiplicativeAction, by including a new type, Scalar eg
-- | Multiplicative Action
class
(Multiplicative (Scalar m)) =>
MultiplicativeAction m
where
type Scalar m :: Type
infixl 7 .*
(.*) :: Scalar m -> m -> m
(*.) = flip (.*)
I released 0.11 which goes with (|) rather than (.) etc. The dot was confusing some formatters and . is a way overused symbol in haskell. I hope it makes sense for your usage.
I'd like to be able to write a calculation
(a *. b) *. c
wherea :: A
,b :: B
andc :: C
.I defined instances
MultiplicativeAction A B
andMultiplicativeAction A C
. Nowa *. b :: A
and denote that witha'
, anda' *. c :: A
, the types seem to match up. However, now I get the errorFunctional dependencies conflict between instance declarations
(as they do).There's surely a reason why the fundep is there, but I couldn't find the reason in the Haddocks, the code or the Git history. Could you open this up a bit?
The text was updated successfully, but these errors were encountered: