úÎ#š7–w:      !"#$%&'()*+,-./0123456789(c) 2020 KowainikMPL-2.0Kowainik <xrom.xkov@gmail.com>None"#%,-./17;=>?@AHMPUVX_gk”ê0trialType family to map $ to the corresponding field for the S approach. This is a Higher-Kinded Data approach specialised to custom enumeration.trialType family to map $ to the corresponding field for the S approach. This is a Higher-Kinded Data approach specialised to custom enumeration.trialBThe phase of the configurations. This type is parametrised by the e (error) type of the X data type. It is a phantom parameter. So it could easily be used in the following way:  Phase Text.trialIn addition to usual  capabilities,  allows attaching a tagO to the resulting value, so you can track which event helped to obtain a value.trialx is a data type that stores history of all events happened with a value. In addition, each event is associated with the  8 level that indicates whether the event is fatal or not.API provided by trial# guarantees the following property:If the final value is J, it is either an empty list or a list with at least one event with the   level  .trial(Stores list of events with the explicit   level.trial*Store list of events and the final result. trial!Severity of the event in history. $: fatal error that led to the final  5: non-essential error, which didn't affect the result You can't create values of type  &, you can only pattern-match on them. @ smart constructors and instances take care of assigning proper   values.Use   and  & Pattern Synonyms to pattern match on  ::{"showFatality :: Fatality -> String showFatality Warning = "Warning"showFatality Error = "Error":} trial$Uni-directional Pattern Synonym for 0 that allows pattern-matching directly on lists. trial$Uni-directional Pattern Synonym for 0 that allows pattern-matching directly on lists. trial  pattern synonym. trial  pattern synonym.trial"Alternative implementation of the : instance for . Return the first *. Otherwise, append two histories in both s. both s.fiasco "No info" `alt` pure 42Result (fromList []) 42#pure 42 `alt` result "Something" 10Result (fromList []) 42)fiasco "No info" `alt` fiasco "Some info"1Fiasco (fromList [(E,"No info"),(E,"Some info")])trialSmart constructor for  . Returns  with a single event and    .trialSmart constructor for  . Returns ' with a list of events, where each has    .trialSmart constructor for  . Returns  with a single event of    .Hint: Use ; to create a  with an empty list of events.trialPredicate on if the given  is .isFiasco (fiasco 'e')TrueisFiasco (result 'a' 42)FalsetrialPredicate on if the given  is .isResult (result 'a' 42)TrueisResult (fiasco 'e')FalsetrialApplies the given action to  if it is # and returns the value. In case of  the default value is returned.NwhenResult "bar" (fiasco "foo") (\es a -> "success!" <$ (print a >> print es))"bar"QwhenResult "bar" (result "res" 42) (\es a -> "success!" <$ (print a >> print es))42["res"] "success!"trialApplies given action to the  content if it is . Similar to  but the default value is ().9whenResult_ (fiasco "foo") (\es a -> print a >> print es)=whenResult_ (result "res" 42) (\es a -> print a >> print es)42["res"]trialApplies the given action to  if it is $ and returns the result. In case of  the default value is returned.7whenFiasco "bar" (fiasco 42) (\es -> "foo" <$ print es)[(E,42)]"foo"=whenFiasco "bar" (result "res" 42) (\es -> "foo" <$ print es)"bar"trialApplies given action to the  content if it is . Similar to  but the default value is ().#whenFiasco_ (result "res" 42) print whenFiasco_ (fiasco "foo") print [(E,"foo")]trialConvert < to  but assigning     when the value is =.#maybeToTrial "No default" (Just 10)Result (fromList []) 10!maybeToTrial "No default" Nothing$Fiasco (fromList [(E,"No default")]) Functions  and  satisfy property:  .  e "a > trial 'Convert  to <# by losing all history information.!trialToMaybe $ fiasco "Some info"Nothing"trialToMaybe $ result "From CLI" 3Just 3trialConvert ? to  by assigning     to a @ value.eitherToTrial (Right 42)Result (fromList []) 42$eitherToTrial (Left "Missing value")'Fiasco (fromList [(E,"Missing value")]) Functions  and  satisfy property:  .  "a > trialConvert  to ?% by concatenating all history events.#trialToEither (result "No info" 42)Right 420trialToEither $ fiascos $ "Hello, " :| ["there"]Left "Hello, there"trialTag a .withTag "Answer" $ pure 42"Result (fromList []) ("Answer",42)%withTag "Answer" $ fiasco "No answer"#Fiasco (fromList [(E,"No answer")])trialUntag a  by adding a tag to a history of events."unTag $ pure ("Chosen randomly",5)'Result (fromList ["Chosen randomly"]) 5unTag $ fiasco "No random"#Fiasco (fromList [(E,"No random")])trial\Tag a value with a given tag, and add a message to events using tag and a name if the given A is B.When used like this: $fiascoOnEmpty "CLI" "port" someList !it's equivalent to the following:  "CLI" $ case someList of [] -> 7 "No CLI option specified for: port" xs -> pure xs trialGet the list of  s and  s together with the <  if applicable."getTrialInfo $ result "Warning" 42([(W,"Warning")],Just 42)getTrialInfo $ fiasco "Error"([(E,"Error")],Nothing) trial Returns all   s in the  constructor. If the given  is $ then returns an empty list instead.!fiascoErrors $ fiasco "One Error" ["One Error"]"fiascoErrors $ result "Warning" 42[]4fiascoErrors (fiasco "Error" *> result "Warning" 42) ["Error"]!trial Returns all   s in the  constructor. If the given  is $ then returns an empty list instead.#fiascoWarnings $ fiasco "One Error"[]$fiascoWarnings $ result "Warning" 42[]6fiascoWarnings (fiasco "Error" *> result "Warning" 42) ["Warning"]"trial Returns all   s in the  constructor. If the given  is $ then returns an empty list instead.#resultWarnings $ fiasco "One Error"[]$resultWarnings $ result "Warning" 42 ["Warning"]6resultWarnings (fiasco "Error" *> result "Warning" 42)[]#trial Returns all   s in the ". These includes both warnings in  of in . anyWarnings $ fiasco "One Error"[]!anyWarnings $ result "Warning" 42 ["Warning"]3anyWarnings (fiasco "Error" *> result "Warning" 42) ["Warning"]$trialHelper function to convert C to list.%trialPrint aligned and colourful  :  in yellow  in redSee & for examples.&trialColourful pretty-printing of . chttps://user-images.githubusercontent.com/8126674/82759167-830c9b80-9de3-11ea-8e72-c5f6c2cdcb6e.pngFiasco chttps://user-images.githubusercontent.com/8126674/82759176-8b64d680-9de3-11ea-8426-e5de941ae9a4.pngResult'trial Similar to &<, but accepts a function to show Result in the provided way.(trialColourful pretty-printing of  . Similar to & , but also prints the resulting tag for . chttps://user-images.githubusercontent.com/8126674/82759188-93bd1180-9de3-11ea-8a76-337d73cf6cc0.pngTag)trial Similar to (%, but accepts a function to show the  in the provided way.*trial5Convenient instance to convert record fields of type  to ² by appending field names to the history. This instance automatically combines tags and record field names into human readable message, so the resulting history has more context.+trial,trial-trial.trialReturn the first / with the whole history before it. If both are  s, return s with the histories combined.fiasco "No info" <|> pure 42 Result (fromList ["No info"]) 42!pure 42 <|> result "Something" 10Result (fromList []) 42'fiasco "No info" <|> fiasco "Some info"1Fiasco (fromList [(E,"No info"),(E,"Some info")])See # if you want a different behaviour./trial Combine two s but recording all  events inside  as  s.*fiasco "No default" <*> fiasco "No config"4Fiasco (fromList [(E,"No default"),(E,"No config")])4fiasco "No default" *> result "Option deprecated" 10<Fiasco (fromList [(E,"No default"),(W,"Option deprecated")]);(,) <$> result "Redundant" 10 <*> result "No CLI Flag" True7Result (fromList ["Redundant","No CLI Flag"]) (10,True)(result "Option deprecated" 10 *> pure 42*Result (fromList ["Option deprecated"]) 420trial1trial Combine two  values. Returns  if at least one argument is .!Let's create some default values: f1 = fiasco "Not initialised..."f2 = fiasco "Parsing error!"r1 = result "r1: From CLI" 5r2 = result "r2: Default" 426And here is how combination of those values look like:f1 <> f2AFiasco (fromList [(E,"Not initialised..."),(E,"Parsing error!")])f1 <> r19Result (fromList ["Not initialised...","r1: From CLI"]) 5f2 <> r25Result (fromList ["Parsing error!","r2: Default"]) 42r1 <> r23Result (fromList ["r1: From CLI","r2: Default"]) 42f1 <> r1 <> f2 <> r2YResult (fromList ["Not initialised...","r1: From CLI","Parsing error!","r2: Default"]) 42trialTagtrial Field nametrialContainer of elements*  !"#$%&'()*   !"#$%&'()333D      !"#$%&'()*+,-./0123456789:;<=;<>;?@;?A;<B;CD;CE;FG;FHIJKLtrial-0.0.0.0-inplaceTrial::-:-PhasePartialFinal TaggedTrialFiascoResultFatalityResultLFiascoLErrorWarningaltfiascofiascosresultisFiascoisResult whenResult whenResult_ whenFiasco whenFiasco_ maybeToTrial trialToMaybe eitherToTrial trialToEitherwithTagunTag fiascoOnEmpty getTrialInfo fiascoErrorsfiascoWarningsresultWarnings anyWarnings dlistToListprettyFatality prettyTrialprettyTrialWithprettyTaggedTrialprettyTaggedTrialWith$fIsLabellabel->$fBitraversableTrial$fBifoldableTrial$fBifunctorTrial$fAlternativeTrial$fApplicativeTrial$fFunctorTrial$fSemigroupTrial$fShowFatality $fEqFatality$fEnumFatality$fBoundedFatality $fShowTrial $fEqTrial $fShowPhase $fEqPhasebaseGHC.Base Alternativepure GHC.MaybeMaybeNothingid Data.EitherEitherLeft Data.FoldableFoldablenullNdlist-0.8.0.8-0acb06d8d5d2c1c342356ae756eff73a4a7991737b2d91ffddc1531d19685dff Data.DListDList