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
Since you already have Alpha, you could write a single function (maybe fromAlpha) which defines all currencies as a case over all Alphas. Then currencies becomes fromAlpha <$> [minBound..maxBound] and each currency function is either unnecessary or trivial (e.g. usd = fromAlpha USD).
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion. I wanted to rework a bit the implementation anyway (noticed that compilation & runtime can be rather slow because of the default Read instance, writing it "by hand" speeds up things a lot. It seems that GHC doesn't like much big ADTs like this).
Since you already have
Alpha
, you could write a single function (maybefromAlpha
) which defines all currencies as acase
over allAlpha
s. Thencurrencies
becomesfromAlpha <$> [minBound..maxBound]
and each currency function is either unnecessary or trivial (e.g.usd = fromAlpha USD
).The text was updated successfully, but these errors were encountered: