On Tue, Oct 30, 2012 at 12:13 AM, Richard O'Keefe
<ok@cs.otago.ac.nz> wrote:
On 30/10/2012, at 5:56 PM, Alexander Solla wrote:
> For example, I generally prefer using the combinators directly when dealing with functors, applicatives, and monads. This can be written "wide", but it can also be written in the style of:
>
> > f' = f <$> (a >>= g)
> > <*> (b >>= h)
> > <*> (c >>= i >>= k)
>
> That is perfectly sensible. But if I had to repeat this syntactic construct, I would probably do it wide:
>
> > f' = f <$> (a >>= g) <*> (b >>= h) <*> (c >>= i >>= k)
> > g' = g <$> (d >>= g) <*> (e >>= h) <*> (f >>= i >>= k)
021346789021346789021346789021346789021346789021346789
>
> The new row exposes a sort of "tabular" structure.
The trouble is that this is not real code.
It's real enough. Throw in some sensible naming and we'll probably be near 80 columns. A few long names and we'll be near 90. Throw in another argument to f and we'll have at least another 6 columns.
I'm sure plenty of us use the applicative-monad "pattern", even with functions which take a large number of arguments.
As it stands, nobody is complaining about this example.
It fits well into 65 columns, being 60 columns wide.
I really would like to see real examples.
-- | 'countries_and_iso_country_codes' represents the bijection between 'Country's and
-- their 'ISOCountryCode's.
countries_and_iso_country_codes :: [ (Country, ISOCountryCode) ]
countries_and_iso_country_codes =
[ ( Afghanistan , ISOCountryCode AF AFG (isoNumericCode 004) )
, ( AlandIslands , ISOCountryCode AX ALA (isoNumericCode 248) )
, ( Albania , ISOCountryCode AL ALB (isoNumericCode 008) )
, ( Algeria , ISOCountryCode DZ DZA (isoNumericCode 012) )
, ( AmericanSamoa , ISOCountryCode AS ASM (isoNumericCode 016) )
, ( Andorra , ISOCountryCode AD AND (isoNumericCode 020) )
, ( Angola , ISOCountryCode AO AGO (isoNumericCode 024) )
, ( Anguilla , ISOCountryCode AI AIA (isoNumericCode 660) )
, ( Antarctica , ISOCountryCode AQ ATA (isoNumericCode 010) )
, ( AntiguaAndBarbuda , ISOCountryCode AG ATG (isoNumericCode 028) )
, ( Argentina , ISOCountryCode AR ARG (isoNumericCode 032) )
, ( Armenia , ISOCountryCode AM ARM (isoNumericCode 051) )
, ( Aruba , ISOCountryCode AW ABW (isoNumericCode 533) )
, ( Australia , ISOCountryCode AU AUS (isoNumericCode 036) )
, ( Austria , ISOCountryCode AT AUT (isoNumericCode 040) )
, ( Azerbaijan , ISOCountryCode AZ AZE (isoNumericCode 031) )
, ( Bahamas , ISOCountryCode BS BHS (isoNumericCode 044) )
, ( Bahrain , ISOCountryCode BH BHR (isoNumericCode 048) )
, ( Bangladesh , ISOCountryCode BD BGD (isoNumericCode 050) )
, ( Barbados , ISOCountryCode BB BRB (isoNumericCode 052) )
, ( Belarus , ISOCountryCode BY BLR (isoNumericCode 112) )
, ( Belgium , ISOCountryCode BE BEL (isoNumericCode 056) )
, ( Belize , ISOCountryCode BZ BLZ (isoNumericCode 084) )
, ( Benin , ISOCountryCode BJ BEN (isoNumericCode 204) )
, ( Bermuda , ISOCountryCode BM BMU (isoNumericCode 060) )
, ( Bhutan , ISOCountryCode BT BTN (isoNumericCode 064) )
, ( Bolivia , ISOCountryCode BO BOL (isoNumericCode 068) )
, ( BosniaAndHerzegovina , ISOCountryCode BA BIH (isoNumericCode 070) )
, ( Botswana , ISOCountryCode BW BWA (isoNumericCode 072) )
, ( BouvetIsland , ISOCountryCode BV BVT (isoNumericCode 074) )
, ( Brazil , ISOCountryCode BR BRA (isoNumericCode 076) )
, ( BritishIndianOceanTerritory , ISOCountryCode IO IOT (isoNumericCode 086) )
, ( BruneiDarussalam , ISOCountryCode BN BRN (isoNumericCode 096) )
, ( Bulgaria , ISOCountryCode BG BGR (isoNumericCode 100) )
, ( BurkinaFaso , ISOCountryCode BF BFA (isoNumericCode 854) )
, ( Burundi , ISOCountryCode BI BDI (isoNumericCode 108) )
, ( Cambodia , ISOCountryCode KH KHM (isoNumericCode 116) )
, ( Cameroon , ISOCountryCode CM CMR (isoNumericCode 120) )
, ( Canada , ISOCountryCode CA CAN (isoNumericCode 124) )
, ( CapeVerde , ISOCountryCode CV CPV (isoNumericCode 132) )
, ( CaymanIslands , ISOCountryCode KY CYM (isoNumericCode 136) )
, ( CentralAfricanRepublic , ISOCountryCode CF CAF (isoNumericCode 140) )
, ( Chad , ISOCountryCode TD TCD (isoNumericCode 148) )
, ( Chile , ISOCountryCode CL CHL (isoNumericCode 152) )
, ( China , ISOCountryCode CN CHN (isoNumericCode 156) )
, ( ChristmasIsland , ISOCountryCode CX CXR (isoNumericCode 162) )
, ( CocosKeelingIslands , ISOCountryCode CC CCK (isoNumericCode 166) )
, ( Colombia , ISOCountryCode CO COL (isoNumericCode 170) )
, ( Comoros , ISOCountryCode KM COM (isoNumericCode 174) )
, ( Congo , ISOCountryCode CG COG (isoNumericCode 178) )
, ( DemocraticRepublicOfCongo , ISOCountryCode CD COD (isoNumericCode 180) )
, ( CookIslands , ISOCountryCode CK COK (isoNumericCode 184) )
, ( CostaRica , ISOCountryCode CR CRI (isoNumericCode 188) )
, ( CoteDIvoire , ISOCountryCode CI CIV (isoNumericCode 384) )
, ( Croatia , ISOCountryCode HR HRV (isoNumericCode 191) )
, ( Cuba , ISOCountryCode CU CUB (isoNumericCode 192) )
, ( Cyprus , ISOCountryCode CY CYP (isoNumericCode 196) )
, ( CzechRepublic , ISOCountryCode CZ CZE (isoNumericCode 203) )
, ( Denmark , ISOCountryCode DK DNK (isoNumericCode 208) )
, ( Djibouti , ISOCountryCode DJ DJI (isoNumericCode 262) )
, ( Dominica , ISOCountryCode DM DMA (isoNumericCode 212) )
, ( DominicanRepublic , ISOCountryCode DO DOM (isoNumericCode 214) )
, ( Ecuador , ISOCountryCode EC ECU (isoNumericCode 218) )
, ( Egypt , ISOCountryCode EG EGY (isoNumericCode 818) )
, ( ElSalvador , ISOCountryCode SV SLV (isoNumericCode 222) )
, ( EquatorialGuinea , ISOCountryCode GQ GNQ (isoNumericCode 226) )
, ( Eritrea , ISOCountryCode ER ERI (isoNumericCode 232) )
, ( Estonia , ISOCountryCode EE EST (isoNumericCode 233) )
, ( Ethiopia , ISOCountryCode ET ETH (isoNumericCode 231) )
, ( FalklandIslands , ISOCountryCode FK FLK (isoNumericCode 238) )
, ( FaroeIslands , ISOCountryCode FO FRO (isoNumericCode 234) )
, ( Fiji , ISOCountryCode FJ FJI (isoNumericCode 242) )
, ( Finland , ISOCountryCode FI FIN (isoNumericCode 246) )
, ( France , ISOCountryCode FR FRA (isoNumericCode 250) )
, ( FrenchGuiana , ISOCountryCode GF GUF (isoNumericCode 254) )
, ( FrenchPolynesia , ISOCountryCode PF PYF (isoNumericCode 258) )
, ( FrenchSouthernTerritories , ISOCountryCode TF ATF (isoNumericCode 260) )
, ( Gabon , ISOCountryCode GA GAB (isoNumericCode 266) )
, ( Gambia , ISOCountryCode GM GMB (isoNumericCode 270) )
, ( Georgia , ISOCountryCode GE GEO (isoNumericCode 268) )
, ( Germany , ISOCountryCode DE DEU (isoNumericCode 276) )
, ( Ghana , ISOCountryCode GH GHA (isoNumericCode 288) )
, ( Gibraltar , ISOCountryCode GI GIB (isoNumericCode 292) )
, ( Greece , ISOCountryCode GR GRC (isoNumericCode 300) )
, ( Greenland , ISOCountryCode GL GRL (isoNumericCode 304) )
, ( Grenada , ISOCountryCode GD GRD (isoNumericCode 308) )
, ( Guadeloupe , ISOCountryCode GP GLP (isoNumericCode 312) )
, ( Guam , ISOCountryCode GU GUM (isoNumericCode 316) )
, ( Guatemala , ISOCountryCode GT GTM (isoNumericCode 320) )
, ( Guernsey , ISOCountryCode GG GGY (isoNumericCode 831) )
, ( Guinea , ISOCountryCode GN GIN (isoNumericCode 324) )
, ( GuineaBissau , ISOCountryCode GW GNB (isoNumericCode 624) )
, ( Guyana , ISOCountryCode GY GUY (isoNumericCode 328) )
, ( Haiti , ISOCountryCode HT HTI (isoNumericCode 332) )
, ( HeardIslandAndMcDonaldIslands , ISOCountryCode HM HMD (isoNumericCode 334) )
, ( HolySee , ISOCountryCode VA VAT (isoNumericCode 336) )
, ( Honduras , ISOCountryCode HN HND (isoNumericCode 340) )
, ( HongKong , ISOCountryCode HK HKG (isoNumericCode 344) )
, ( Hungary , ISOCountryCode HU HUN (isoNumericCode 348) )
, ( Iceland , ISOCountryCode IS ISL (isoNumericCode 352) )
, ( India , ISOCountryCode IN IND (isoNumericCode 356) )
, ( Indonesia , ISOCountryCode ID IDN (isoNumericCode 360) )
, ( Iran , ISOCountryCode IR IRN (isoNumericCode 364) )
, ( Iraq , ISOCountryCode IQ IRQ (isoNumericCode 368) )
, ( Ireland , ISOCountryCode IE IRL (isoNumericCode 372) )
, ( IsleOfMan , ISOCountryCode IM IMN (isoNumericCode 833) )
, ( Israel , ISOCountryCode IL ISR (isoNumericCode 376) )
, ( Italy , ISOCountryCode IT ITA (isoNumericCode 380) )
, ( Jamaica , ISOCountryCode JM JAM (isoNumericCode 388) )
, ( Japan , ISOCountryCode JP JPN (isoNumericCode 392) )
, ( Jersey , ISOCountryCode JE JEY (isoNumericCode 832) )
, ( Jordan , ISOCountryCode JO JOR (isoNumericCode 400) )
, ( Kazakhstan , ISOCountryCode KZ KAZ (isoNumericCode 398) )
, ( Kenya , ISOCountryCode KE KEN (isoNumericCode 404) )
, ( Kiribati , ISOCountryCode KI KIR (isoNumericCode 296) )
, ( NorthKorea , ISOCountryCode KP PRK (isoNumericCode 408) )
, ( SouthKorea , ISOCountryCode KR KOR (isoNumericCode 410) )
, ( Kuwait , ISOCountryCode KW KWT (isoNumericCode 414) )
, ( Kyrgyzstan , ISOCountryCode KG KGZ (isoNumericCode 417) )
, ( Laos , ISOCountryCode LA LAO (isoNumericCode 418) )
, ( Latvia , ISOCountryCode LV LVA (isoNumericCode 428) )
, ( Lebanon , ISOCountryCode LB LBN (isoNumericCode 422) )
, ( Lesotho , ISOCountryCode LS LSO (isoNumericCode 426) )
, ( Liberia , ISOCountryCode LR LBR (isoNumericCode 430) )
, ( Libya , ISOCountryCode LY LBY (isoNumericCode 434) )
, ( Liechtenstein , ISOCountryCode LI LIE (isoNumericCode 438) )
, ( Lithuania , ISOCountryCode LT LTU (isoNumericCode 440) )
, ( Luxembourg , ISOCountryCode LU LUX (isoNumericCode 442) )
, ( Macao , ISOCountryCode MO MAC (isoNumericCode 446) )
, ( Macedonia , ISOCountryCode MK MKD (isoNumericCode 807) )
, ( Madagascar , ISOCountryCode MG MDG (isoNumericCode 450) )
, ( Malawi , ISOCountryCode MW MWI (isoNumericCode 454) )
, ( Malaysia , ISOCountryCode MY MYS (isoNumericCode 458) )
, ( Maldives , ISOCountryCode MV MDV (isoNumericCode 462) )
, ( Mali , ISOCountryCode ML MLI (isoNumericCode 466) )
, ( Malta , ISOCountryCode MT MLT (isoNumericCode 470) )
, ( MarshallIslands , ISOCountryCode MH MHL (isoNumericCode 584) )
, ( Martinique , ISOCountryCode MQ MTQ (isoNumericCode 474) )
, ( Mauritania , ISOCountryCode MR MRT (isoNumericCode 478) )
, ( Mauritius , ISOCountryCode MU MUS (isoNumericCode 480) )
, ( Mayotte , ISOCountryCode YT MYT (isoNumericCode 175) )
, ( Mexico , ISOCountryCode MX MEX (isoNumericCode 484) )
, ( Micronesia , ISOCountryCode FM FSM (isoNumericCode 583) )
, ( Moldova , ISOCountryCode MD MDA (isoNumericCode 498) )
, ( Monaco , ISOCountryCode MC MCO (isoNumericCode 492) )
, ( Mongolia , ISOCountryCode MN MNG (isoNumericCode 496) )
, ( Montenegro , ISOCountryCode ME MNE (isoNumericCode 499) )
, ( Montserrat , ISOCountryCode MS MSR (isoNumericCode 500) )
, ( Morocco , ISOCountryCode MA MAR (isoNumericCode 504) )
, ( Mozambique , ISOCountryCode MZ MOZ (isoNumericCode 508) )
, ( Myanmar , ISOCountryCode MM MMR (isoNumericCode 104) )
, ( Namibia , ISOCountryCode NA NAM (isoNumericCode 516) )
, ( Nauru , ISOCountryCode NR NRU (isoNumericCode 520) )
, ( Nepal , ISOCountryCode NP NPL (isoNumericCode 524) )
, ( Netherlands , ISOCountryCode NL NLD (isoNumericCode 528) )
, ( NetherlandsAntilles , ISOCountryCode AN ANT (isoNumericCode 530) )
, ( NewCaledonia , ISOCountryCode NC NCL (isoNumericCode 540) )
, ( NewZealand , ISOCountryCode NZ NZL (isoNumericCode 554) )
, ( Nicaragua , ISOCountryCode NI NIC (isoNumericCode 558) )
, ( Niger , ISOCountryCode NE NER (isoNumericCode 562) )
, ( Nigeria , ISOCountryCode NG NGA (isoNumericCode 566) )
, ( Niue , ISOCountryCode NU NIU (isoNumericCode 570) )
, ( NorfolkIsland , ISOCountryCode NF NFK (isoNumericCode 574) )
, ( NorthernMarianaIslands , ISOCountryCode MP MNP (isoNumericCode 580) )
, ( Norway , ISOCountryCode NO NOR (isoNumericCode 578) )
, ( Oman , ISOCountryCode OM OMN (isoNumericCode 512) )
, ( Pakistan , ISOCountryCode PK PAK (isoNumericCode 586) )
, ( Palau , ISOCountryCode PW PLW (isoNumericCode 585) )
, ( Palestinine , ISOCountryCode PS PSE (isoNumericCode 275) )
, ( Panama , ISOCountryCode PA PAN (isoNumericCode 591) )
, ( PapuaNewGuinea , ISOCountryCode PG PNG (isoNumericCode 598) )
, ( Paraguay , ISOCountryCode PY PRY (isoNumericCode 600) )
, ( Peru , ISOCountryCode PE PER (isoNumericCode 604) )
, ( Philippines , ISOCountryCode PH PHL (isoNumericCode 608) )
, ( Pitcairn , ISOCountryCode PN PCN (isoNumericCode 612) )
, ( Poland , ISOCountryCode PL POL (isoNumericCode 616) )
, ( Portugal , ISOCountryCode PT PRT (isoNumericCode 620) )
, ( PuertoRico , ISOCountryCode PR PRI (isoNumericCode 630) )
, ( Qatar , ISOCountryCode QA QAT (isoNumericCode 634) )
, ( Reunion , ISOCountryCode RE REU (isoNumericCode 638) )
, ( Romania , ISOCountryCode RO ROU (isoNumericCode 642) )
, ( RussianFederation , ISOCountryCode RU RUS (isoNumericCode 643) )
, ( Rwanda , ISOCountryCode RW RWA (isoNumericCode 646) )
, ( SaintBarthelemy , ISOCountryCode BL BLM (isoNumericCode 652) )
, ( SaintHelenaAscensionAndTristanDaCunha , ISOCountryCode SH SHN (isoNumericCode 654) )
, ( SaintKittsAndNevis , ISOCountryCode KN KNA (isoNumericCode 659) )
, ( SaintLucia , ISOCountryCode LC LCA (isoNumericCode 662) )
, ( SaintMartin , ISOCountryCode MF MAF (isoNumericCode 663) )
, ( SaintPierreAndMiquelon , ISOCountryCode PM SPM (isoNumericCode 666) )
, ( SaintVincentAndTheGrenadines , ISOCountryCode VC VCT (isoNumericCode 670) )
, ( Samoa , ISOCountryCode WS WSM (isoNumericCode 882) )
, ( SanMarino , ISOCountryCode SM SMR (isoNumericCode 674) )
, ( SaoTomeAndPrincipe , ISOCountryCode ST STP (isoNumericCode 678) )
, ( SaudiArabia , ISOCountryCode SA SAU (isoNumericCode 682) )
, ( Senegal , ISOCountryCode SN SEN (isoNumericCode 686) )
, ( Serbia , ISOCountryCode RS SRB (isoNumericCode 688) )
, ( Seychelles , ISOCountryCode SC SYC (isoNumericCode 690) )
, ( SierraLeone , ISOCountryCode SL SLE (isoNumericCode 694) )
, ( Singapore , ISOCountryCode SG SGP (isoNumericCode 702) )
, ( Slovakia , ISOCountryCode SK SVK (isoNumericCode 703) )
, ( Slovenia , ISOCountryCode SI SVN (isoNumericCode 705) )
, ( SolomonIslands , ISOCountryCode SB SLB (isoNumericCode 090) )
, ( Somalia , ISOCountryCode SO SOM (isoNumericCode 706) )
, ( SouthAfrica , ISOCountryCode ZA ZAF (isoNumericCode 710) )
, ( SouthGeorgiaAndtheSouthSandwichIslands , ISOCountryCode GS SGS (isoNumericCode 239) )
, ( Spain , ISOCountryCode ES ESP (isoNumericCode 724) )
, ( SriLanka , ISOCountryCode LK LKA (isoNumericCode 144) )
, ( Sudan , ISOCountryCode SD SDN (isoNumericCode 736) )
, ( Suriname , ISOCountryCode SR SUR (isoNumericCode 740) )
, ( SvalbardAndJanMayen , ISOCountryCode SJ SJM (isoNumericCode 744) )
, ( Swaziland , ISOCountryCode SZ SWZ (isoNumericCode 748) )
, ( Sweden , ISOCountryCode SE SWE (isoNumericCode 752) )
, ( Switzerland , ISOCountryCode CH CHE (isoNumericCode 756) )
, ( Syria , ISOCountryCode SY SYR (isoNumericCode 760) )
, ( Taiwan , ISOCountryCode TW TWN (isoNumericCode 158) )
, ( Tajikistan , ISOCountryCode TJ TJK (isoNumericCode 762) )
, ( Tanzania , ISOCountryCode TZ TZA (isoNumericCode 834) )
, ( Thailand , ISOCountryCode TH THA (isoNumericCode 764) )
, ( TimorLeste , ISOCountryCode TL TLS (isoNumericCode 626) )
, ( Togo , ISOCountryCode TG TGO (isoNumericCode 768) )
, ( Tokelau , ISOCountryCode TK TKL (isoNumericCode 772) )
, ( Tonga , ISOCountryCode TO TON (isoNumericCode 776) )
, ( TrinidadAndTobago , ISOCountryCode TT TTO (isoNumericCode 780) )
, ( Tunisia , ISOCountryCode TN TUN (isoNumericCode 788) )
, ( Turkey , ISOCountryCode TR TUR (isoNumericCode 792) )
, ( Turkmenistan , ISOCountryCode TM TKM (isoNumericCode 795) )
, ( TurksAndCaicosIslands , ISOCountryCode TC TCA (isoNumericCode 796) )
, ( Tuvalu , ISOCountryCode TV TUV (isoNumericCode 798) )
, ( Uganda , ISOCountryCode UG UGA (isoNumericCode 800) )
, ( Ukraine , ISOCountryCode UA UKR (isoNumericCode 804) )
, ( UnitedArabEmirates , ISOCountryCode AE ARE (isoNumericCode 784) )
, ( UnitedKingdom , ISOCountryCode GB GBR (isoNumericCode 826) )
, ( UnitedStates , ISOCountryCode US USA (isoNumericCode 840) )
, ( UnitedStatesMinorOutlyingIslands , ISOCountryCode UM UMI (isoNumericCode 581) )
, ( Uruguay , ISOCountryCode UY URY (isoNumericCode 858) )
, ( Uzbekistan , ISOCountryCode UZ UZB (isoNumericCode 860) )
, ( Vanuatu , ISOCountryCode VU VUT (isoNumericCode 548) )
, ( Venezuela , ISOCountryCode VE VEN (isoNumericCode 862) )
, ( VietNam , ISOCountryCode VN VNM (isoNumericCode 704) )
, ( BritishVirginIslands , ISOCountryCode VG VGB (isoNumericCode 092) )
, ( USVirginIslands , ISOCountryCode VI VIR (isoNumericCode 850) )
, ( WallisAndFutuna , ISOCountryCode WF WLF (isoNumericCode 876) )
, ( WesternSahara , ISOCountryCode EH ESH (isoNumericCode 732) )
, ( Yemen , ISOCountryCode YE YEM (isoNumericCode 887) )
, ( Zambia , ISOCountryCode ZM ZMB (isoNumericCode 894) )
, ( Zimbabwe , ISOCountryCode ZW ZWE (isoNumericCode 716) )
]