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
As a starter, here's two alternative recipies for an instance of a sum-type:
type FontLocation=GoogleFontLocation|UriFontLocationString|LocalFontLocationfontLocationThruEither:HashingFontLocationfontLocationThruEither =
either int (string 3)|>
map (\ a ->case a ofGoogleFontLocation->Either.Left0UriFontLocation b ->Either.Right b
LocalFontLocation->Either.Left1)fontLocationThruProduct:HashingFontLocationfontLocationThruProduct =
concat
[
map .tag int,
map .uri (string 3)]|>
map (\ a ->case a ofGoogleFontLocation->{tag =0, uri =""}UriFontLocation b ->{tag =1, uri = b}LocalFontLocation->{tag =2, uri =""})
type FontWeight=ThinFontWeight|UltraLightFontWeight|LightFontWeight|NormalFontWeight|MediumFontWeight|SemiBoldFontWeight|BoldFontWeight|UltraBoldFontWeight|BlackFontWeight|UltraBlackFontWeightfontWeight:HashingFontWeightfontWeight =
int |>
map (\ a ->case a ofThinFontWeight->0UltraLightFontWeight->1LightFontWeight->2NormalFontWeight->3MediumFontWeight->4SemiBoldFontWeight->5BoldFontWeight->6UltraBoldFontWeight->7BlackFontWeight->8UltraBlackFontWeight->9)
It's not obvious currently how the API can be used to achieve that.
This thread is intended for collection of examples, which you're very welcome to post as comments.
The text was updated successfully, but these errors were encountered: