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
But, consider changing the interface of e.g. 'diffMU' to:
diffMU :: Num a => (forall tag. [Dual tag a] -> Dual tag b) -> [(a, a)] -> b
diffMU f = tangent . f . map pair2dual
I.e. instead of taking two lists take a single list of pairs (which
has the added benefit that it becomes impossible to pass lists of
different length by mistake). Now, the above trivially generalizes to:
diffFU :: (Num a, Functor f) => (forall tag. f (Dual tag a) ->
Dual tag b) -> f (a, a) -> b
diffFU f = tangent . f . fmap pair2dual
The others variations should be equally straight forward. If you want
to still provide the original interface for 'diffMU' the definition
would be:
diffMU f xs x's = diffFU f (zip xs x's)
The text was updated successfully, but these errors were encountered:
[From email 2008-02-28]
But, consider changing the interface of e.g. 'diffMU' to:
diffMU :: Num a => (forall tag. [Dual tag a] -> Dual tag b) -> [(a, a)] -> b
diffMU f = tangent . f . map pair2dual
I.e. instead of taking two lists take a single list of pairs (which
has the added benefit that it becomes impossible to pass lists of
different length by mistake). Now, the above trivially generalizes to:
diffFU :: (Num a, Functor f) => (forall tag. f (Dual tag a) ->
Dual tag b) -> f (a, a) -> b
diffFU f = tangent . f . fmap pair2dual
The others variations should be equally straight forward. If you want
to still provide the original interface for 'diffMU' the definition
would be:
diffMU f xs x's = diffFU f (zip xs x's)
The text was updated successfully, but these errors were encountered: