h$O      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklNone-./09<>? idiomatic(This exists in versions that don't have , i.e. before base 4.17.0.0.% idiomatic"The first thing I do is to convert* idiomatic0A polymorphic function / natural transformation. Used for Applicative homomorphisms (Idiom): idiom _ tag :: Idiom tag l r => l ~> r  Definition: type (~>) :: (k -> Type) -> (k -> Type) -> Type type f ~> g = forall x. f x -> g x + idiomatic-The kind of a lifted binary type constructor. Sum :: SumKind k Product :: SumKind k (:+:) :: SumKind k (:*:) :: SumKind k  Definition: type SumKind :: Type -> Type type SumKind k = (k -> Type) -> (k -> Type) -> (k -> Type) , idiomaticm for  Const Void. absurdZero :: Const Void a -> b absurdZero (Const void) = absurd void - idiomaticm for n. &absurdV1 :: V1 a -> b absurdV1 = case . idiomatic"Flattens a generic representation.Afaik GHC is free to nest the generic representation however it fancies. The representation of data A a = A a a a a is for example@ Rep1 A = (Par1 :+: Par1) :+: (Par1 :+: Par1) -- without metadata0 idiomatic0This is actually not safe and causes a segfault.2   !$#"%)('&*+,-./012+*,-%)('&!$#"   ./01None./05<>? G idiomaticThe applicative functor that gets the second component of a product. 1idiom :: Product f g ~> g idiom (Pair _ bs) = bs H idiomaticThe applicative functor that gets the first component of a product. 1idiom :: Product f g ~> f idiom (Pair as _) = as I idiomatic2An applicative functor for constructing a product. idiom :: f ~> Product g h idiom as = Pair (idiom as) (idiom as) J idiomaticThis applicative morphism duplicates a functor any number of times. idiom :: f ~> f idiom = id idiom :: f ~> Product f f idiom as = Pair as as idiom :: f ~> Product f (Product f f) idiom as = Pair as (Pair as as) K idiomatic>This applicative morphism composes a functor on the _outside_. 5idiom :: f ~> Compose outer f idiom = Compose . pure L idiomatic=This applicative morphism composes a functor on the _inside_. :idiom :: f ~> Compose f inner idiom = Compose . fmap pure M idiomatic"The terminal applicative morphism.It turns any applicative into o m, or p idiom :: f ~> Const m idiom _ = Const mempty idiom :: f ~> Proxy idiom _ = Proxy N idiomatic!The initial applicative morphism. It turns q into any r functor. 3idiom :: Identity ~> f idiom (Identity a) = pure a O idiomatic7The left-to-right composition of applicative morphisms.P idiomatic"The identity applicative morphism. idiom :: f ~> f idiom = id Q idiomaticAn Q captures an "applicative homomorphism" between two applicatives, indexed by a tag.An appliative homomorphism is a polymorphic function between two applicative functors that preserves the r structure. idiom (pure a) = pure a idiom (liftA2 () as bs) = liftA2 () (idiom as) (idiom bs)  Based on:  http://ekmett.github.io/reader/2012/abstracting-with-applicatives/index.htmlAbstracting with Applicatives. GHIJKLMNOPQR QRPONMLKJIHGO7None./028<=>` idiomatic.A modifier that is used to generically derive r for sum types.+Types with a single constructor can derive r using  Generically1 from  GHC.Generics: %Generically1 f = Idiomatically f '[] A datatype with multiple constructors requires more input from the user: what constructor should be s and how to map between two different constructors in a law-abiding way.This is done by specifying the appliative morphisms (Q) between each constructor.r for t can be derived via the Terminal- applicative morphism, biased to the right. RightBias Terminal means that when we lift over Nothing and Just it will result in Nothing. data Maybe a = Nothing | Just a deriving stock Generic1 deriving (Functor, Applicative) via Idiomatically Maybe '[RightBias Terminal] The same description derives r for ZipList: type ZipList :: Type -> Type data ZipList a = ZNil | a ::: ZipList deriving stock Generic1 deriving (Functor, Applicative) via Idiomatically ZipList '[RightBias Terminal] a idiomaticAn applicative instance of u biased to the right. It injects s into the v constructor:  pure = LeftBias . InR . pure e idiomaticAn applicative instance of u biased to the left. It injects s into the w constructor:  pure = LeftBias . InL . pure xyz{|}~nz~GHIJKLMNOPQR`abcd cdab`      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abccddefghijklmnompqmrsmtumvwmxymxzm{|m}~m}m}mpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmpmp(idiomatic-0.1.1.0-4cpJUvyafmp5JgyYqCPCtkGeneric.Applicative.InternalGeneric.Applicative.IdiomGeneric.Applicative Generically1NewSumsreduce ReplaceSumsFlattenConvBæProduct_ BæProduct_convBæProductconvHæProductConvBæProduct BæProduct CheckProduct ProductTagRightOne NormalProduct NotProduct ConvBæSum_BæSum_ convBæSum convHæSum ConvBæSumBæSumCheckSumSumTag RightZero NormalSumNotSum ConvFieldToField convToField convFromField ConvProduct ToProduct convToProductconvFromProductConvSumToSum convToSum convToSumSkip convFromSum~>SumKind absurdZeroabsurdV1flattennest replaceSums placeSums $fConvSumkM1 $fConvSumkV1 $fConvSumk:+:$fConvProductkU1$fConvProductk:*: $fConvSumkM10$fConvFieldk:.:$fConvFieldTYPEPar1$fConvFieldkRec1$fConvFieldkK1$fConvProductkM1$fConvBæSum_kNotSumrep1 $fConvBæProduct_kNotProductrep1!$fConvBæProduct_kRightOneProduct&$fConvBæProduct_kNormalProductProduct$fConvBæSum_kNormalSumSum$fConvBæSum_kRightZeroSum$fGeneric1kNewSums$fApplicativeGenerically1$fFunctorGenerically1$fGeneric1kGenerically1SndFst&&&DupOuterInnerTerminalInitialCompIdIdiomidiom$fIdiomTYPEIdfg$fIdiomTYPECompfh$fIdiomTYPEInitialidf$fIdiomTYPETerminalfProxy$fIdiomTYPETerminalfConst$fIdiomTYPEInnerfcomp$fIdiomTYPEOuterfcomp$fIdiomDupTruefProduct$fIdiomDupFalseff'$fIdiomTYPEDupfg$fIdiomTYPE&&&fProduct$fIdiomTYPEFstProductf$fIdiomTYPESndProductg Idiomatically RightBiasLeftBias$fApplicativeLeftBias$fApplicativeRightBias$fIdiomTYPEServeLeftBiasr$fIdiomTYPEServeRightBiasr$fIdiomTYPEServelRightBias$fIdiomTYPEServelLeftBias$fFunctorRightBias$fFunctorLeftBiasbase Data.Voidabsurd GHC.GenericsV1Data.Functor.ConstConst Data.ProxyProxyData.Functor.IdentityIdentityGHC.Base Applicativepure GHC.MaybeMaybeData.Functor.SumSumInRInLGenerictoRepfromGeneric1to1Rep1from1Datatype isNewtype packageName datatypeName moduleName Constructor conIsRecordconName conFixitySelectorselDecidedStrictnessselSourceStrictnessselNameselSourceUnpackednessU1Par1unPar1Rec1unRec1K1unK1M1unM1:+:L1R1:*::.:Comp1unComp1RDCSRec0D1C1S1URecUWordUIntUFloatUDoubleUAddrUCharuAddr#uChar#uDouble#uFloat#uWord#uInt#precFixityPrefixInfixFixityIPrefixIInfixI AssociativityNotAssociativeLeftAssociativeRightAssociativeSourceUnpackednessNoSourceUnpackedness SourceUnpackSourceNoUnpackSourceStrictnessNoSourceStrictness SourceLazy SourceStrictDecidedStrictness DecidedUnpack DecidedLazy DecidedStrictMetaMetaSelMetaDataMetaCons