! V1      !" # $ % &' ( ) *+,-./0123456789:; < = >?@A B CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                    !"#$%&'()*+,-./01234567 8 9 : ; < = > ? @ A B CDEFG H I J K L M N OPQRSTUVWXYZ[\]^_`abc defghijklmnopqrstuvwxyz{|}~            !!!!!!!!!!!!!!!!!!""""########### # # # # #$%%%%%%&&''''''''' '!'"'#'$'%'&('((()(*(+),)-*.*/*03 V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe,reludeShorter alias for pure ().pass :: Maybe ()Just ();(');(')V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Unsafe/r *+ ,-]\[ZYXWVUTSRQPONM. yx/wvutsr2  356~}|{z78>?@DE_FaGHIJKLMOghiPQRSTUVWYZ[\]^jklmn!"$#ACBEDLKJIH^_`ajklmnopq̣aDGHIJKSTUVW^_`M,3OghiACBRjLKJIH ]YZED8mn*+ kl-]\[ZYXWVUTSRQPONME_Fa>2  L. yx/wvutsr56~}|{zPQjklmnopq7?[\!"$#@^V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe6 C`db C`dbV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>None9 ! !V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>None=>?HV@rrelude>Typeclass for data types that can be created from one element.one True :: [Bool][True]one 'a' :: Text"a"&one (3, "hello") :: HashMap Int StringfromList [(3,"hello")] relude(Type of single element of the structure.!reludeCreate a list, map, Text, etc from a single element. ! !+V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>NoneB ! !(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeKV/relude1Creates a tuple by pairing something with itself. dupe "foo" ("foo","foo")dupe ()((),())0reludeNApply a function, with the result in the fst slot, and the value in the other. A dual to 1mapToFst (+1) 10(11,10)1reludeQApply a function, with the result in the second slot, and the value in the other. A dual to 0.mapToSnd (+1) 10(10,11)2relude.Maps a function over both elements of a tuple.&mapBoth ("Hello " <>) ("Alice", "Bob")("Hello Alice","Hello Bob")/012/012 (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeL;<=;<=V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeP3reludeRenamed version of ,-. FGcde3 FGcde3V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeS&1opqrstuxwv{zy~}|fgi&1fgiopqrstuxwv{zy~}|V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe[4relude Alias for  fmap . fmap%. Convenient to work with two nested 1s.negate <<$>> Just [1,2,3]Just [-1,-2,-3]5reludeTakes a function in a 1* context and applies it to a normal value.flap (++) "relude" "P" "Prelude"6reludeOperator version of the 5 function.[(+2), (*3)] ?? 5[7,15]Just (+3) ?? 5Just 8h4564h564464.V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe^*1opqrstuxwv{zy~}|fghi456 V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safeg 7relude Lifted to  version of 1.8relude Lifted to  version of 2.9relude Lifted to  version of 3.:relude Lifted to  version of 4.;relude Lifted to  version of 5.<relude Lifted to  version of 6.=relude Lifted to  version of 7.>relude Lifted to  version of 8.?relude Lifted to  version of 9.@relude Lifted to  version of :.Arelude Lifted to  version of ;.Brelude Lifted to  version of <. 789:;<=>?@AB789:;<=>?@AB V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafelCCreludeLifted version of /0.DreludeLifted version of /1.EreludeLifted version of /2.FreludeLifted version of /3.CDEFCDEF V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safer8GreludeLifted version of =.HreludeLifted version of >.IreludeLifted version of ?.JreludeLifted version of @.KreludeLifted version of A.LreludeLifted version of B.MreludeLifted version of C.NreludeLifted version of D. GHIJKLMN LMNJKGHIV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com> Trustworthyt0%&'()*+,-./01234560%&'()*+,-./0123456V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafexVU&09NbcXef;<=>?@ U &09NbcXef;<=>?@V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeBOrelude Similar to  but with flipped arguments.readMaybe "True" ?: FalseTruereadMaybe "Tru" ?: FalseFalsePreludeSpecialized version of for_ for NC. It's used for code readability. Also helps to avoid space leaks:  Ohttp://www.snoyman.com/blog/2017/01/foldable-mapm-maybe-and-recursive-functionsFoldable.mapM_ space leak.&whenJust Nothing $ \b -> print (not b)*whenJust (Just True) $ \b -> print (not b)FalseQreludeMonadic version of P.RreludePerforms default ; action if b) is given. Otherwise returns content of c pured to ;.!whenNothing Nothing [True, False] [True,False]%whenNothing (Just True) [True, False][True]SreludePerforms default ; action if b is given. Do nothing for c. Convenient for discarding c content.+whenNothing_ Nothing $ putTextLn "Nothing!"Nothing!/whenNothing_ (Just True) $ putTextLn "Nothing!"TreludeMonadic version of R.UreludeMonadic version of U.OPQRSTUOPQRSTUO0V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>NoneVreludeLifted version of E.WreludeLifted version of F.XreludeLifted version of G.VWXVWXV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeP Yrelude$Shorter and more readable alias for flip runReaderT.Zrelude$Shorter and more readable alias for flip runReader.[relude$Shorter and more readable alias for flip runStateT.\relude$Shorter and more readable alias for  flip runState.]relude Alias for flip evalStateTF. It's not shorter but sometimes more readable. Done by analogy with using* functions family.^relude Alias for flip evalStateF. It's not shorter but sometimes more readable. Done by analogy with using* functions family._relude Alias for flip execStateTF. It's not shorter but sometimes more readable. Done by analogy with using* functions family.`relude Alias for flip execStateF. It's not shorter but sometimes more readable. Done by analogy with using* functions family.areludeLift a N to the  monadbreludeLift a X to the  monad YZ[\]^_`ab ZY^]`_\[ab V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe"crelude Extracts B value from N returning # if Nothing.+maybeToMonoid (Just [1,2,3] :: Maybe [Int])[1,2,3]&maybeToMonoid (Nothing :: Maybe [Int])[]-A"B#$%      c-B#$%    A"  cV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafedreludeLike ,4 but runs in  O(n \log n)  time and requires 3.ordNub [3, 3, 3, 2, 2, -1, 1] [3,2,-1,1]ereludeLike ,4 but runs in  O(n \log_{16} n)  time and requires .hashNub [3, 3, 3, 2, 2, -1, 1] [3,2,-1,1]freludeLike d runs in  O(n \log n)  but also sorts a list.sortNub [3, 3, 3, 2, 2, -1, 1] [-1,1,2,3]greludeLike e runs in  O(n \log_{16} n) 7 but has better performance; it doesn't save the order."unstableNub [3, 3, 3, 2, 2, -1, 1] [1,2,3,-1]defgedfgV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeD4:78   :   478V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe=?@ACX^hrelude'Type class for lazy-strict conversions.krelude+Type class for converting other strings to .mrelude+Type class for converting other strings to H.orelude+Type class for converting other strings to .qrelude9Type class for conversion to utf8 representation of text.rreludeEncode as utf8 string (usually ).$encodeUtf8 @Text @ByteString "?0B0:"*"\208\191\208\176\209\130\208\176\208\186"sreludeDecode from utf8 string.GdecodeUtf8 @Text @ByteString "\208\191\208\176\209\130\208\176\208\186""\1087\1072\1090\1072\1082"SputTextLn $ decodeUtf8 @Text @ByteString "\208\191\208\176\209\130\208\176\208\186"?0B0:treludeLDecode as utf8 string but returning execption if byte sequence is malformed.CdecodeUtf8 @Text @ByteString "\208\208\176\209\130\208\176\208\186""\65533\1072\1090\1072\1082"IdecodeUtf8Strict @Text @ByteString "\208\208\176\209\130\208\176\208\186"\Left Cannot decode byte '\xd0': Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 streamureludeType synonym for 56.vreludeType synonym for 78.wreludePolymorhpic version of I.readEither @Text @Int "123" Right 123readEither @Text @Int "aa"Left "Prelude.read: no parse"xreludeGeneralized version of ,9.yrelude Alias for j function.zrelude Alias for i function.}relude Converting  to JK might be a slow operation. Consider using lazy bytestring at first place.hjiklmnopqsrtuvwxyzvuqsrtklmnophjiyzwx:V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe%4:78   hjiklmnopqsrtuvwxyzV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com> Trustworthy=>?XѸreludeLifted version of K.reludeLifted version of L.reludeLifted version of M.reludeLifted version of N.reludeLifted version of O.reludeLifted version of P.reludeLifted version of Q.reludeLifted version of R.V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safea reludeMaps left part of X to N.leftToMaybe (Left True) Just TrueleftToMaybe (Right "aba")NothingreludeMaps right part of X to N.rightToMaybe (Left True)NothingrightToMaybe (Right "aba") Just "aba"reludeMaps N to X wrapping default value into e.maybeToRight True (Just "aba") Right "aba"maybeToRight True Nothing Left TruereludeMaps N to X wrapping default value into f.maybeToLeft True (Just "aba") Left "aba"maybeToLeft True Nothing Right TruereludeApplies given action to X content if e. is given and returns the result. In case of f$ the default value will be returned.reludeApplies given action to X content if e is given.reludeMonadic version of .reludeMonadic version of .reludeApplies given action to X content if f. is given and returns the result. In case of e$ the default value will be returned.reludeApplies given action to X content if f is given.reludeMonadic version of .reludeMonadic version of .9::9;V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safet&09NbcXef9:;<=>?@ OPQRSTUYZ[\]^_`abV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Saferelude.For safe work with lists using functinons for .viaNonEmpty head [1]Just 1viaNonEmpty head []NothingreludePerforms given action over ! list if given list is non empty.+whenNotNull [] $ \(b :| _) -> print (not b)5whenNotNull [False,True] $ \(b :| _) -> print (not b)TruereludeMonadic version of .<V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe3%&'()*+,-./0123456V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe%@Ag^reludeType that represents exceptions used in cases when a particular codepath is not meant to be ever executed, but happens to be executed anyway.reludeaPattern synonym to easy pattern matching on exceptions. So intead of writing something like this: isNonCriticalExc :: SomeException -> Bool isNonCriticalExc e | Just (_ :: NodeAttackedError) <- fromException e = True | Just DialogUnexpected{} <- fromException e = True | otherwise = False  you can use  pattern synonym: isNonCriticalExc :: SomeException -> Bool isNonCriticalExc = case Exc (_ :: NodeAttackedError) -> True -- matching all exceptions of type NodeAttackedError3 Exc DialogUnexpected{} -> True _ -> False +This pattern is bidirectional. You can use Exc e instead of  toException e.SreludeHGenerate a pure value which, when forced, will throw the given exceptionrelude_Generate a pure value which, when forced, will synchronously throw the exception wrapped into  data type.  V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>None reludeLifted alias for T with clearer name.reludeLike  evaluateWNHF but discards value.relude Alias for evaluateWHNF . force with clearer name.relude Alias for evaluateWHNF . rnf . Similar to  but discards resulting value.  V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafereludeMonadic version of .+whenM (pure False) $ putTextLn "No text :(",whenM (pure True) $ putTextLn "Yes text :)" Yes text :)whenM (Just True) (pure ())Just ()whenM (Just False) (pure ())Just ()whenM Nothing (pure ())NothingreludeMonadic version of .-unlessM (pure False) $ putTextLn "No text :(" No text :(-unlessM (pure True) $ putTextLn "Yes text :)"reludeMonadic version of  if-then-else.@ifM (pure True) (putTextLn "True text") (putTextLn "False text") True textreludeMonadic version of @. Occasionally useful. Here some complex but real-life example: findSomePath :: IO (Maybe FilePath) somePath :: MaybeT IO FilePath somePath = do path <- MaybeT findSomePath guardM $ liftIO $ doesDirectoryExist path return path relude-Monadic version of 'Data.Bool.(&&)' operator.-Just False &&^ error "Shouldn't be evaluated" Just Falserelude-Monadic version of 'Data.Bool.(||)' operator.,Just True ||^ error "Shouldn't be evaluated" Just True=V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe]C`dbV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>None -.HUVXD relude Similar to 1 but takes a function with its arguments flipped."flipfoldl' (/) 5 [2,3] :: Rational15 % 2reludePolymorphic version of  concatMapA function.+foldMapA @[Int] (Just . replicate 3) [1..3]Just [1,1,1,2,2,2,3,3,3]reludeAlternative version of asumC >>> asumMap (x -> if x > 2 then Just x else Nothing) [1..3] Just 3reludePolymorphic version of  concatMapM function.+foldMapM @[Int] (Just . replicate 3) [1..3]Just [1,1,1,2,2,2,3,3,3]reludeStricter version of U. sum [1..10]55reludeStricter version of V.product [1..10]3628800reludeLike W but doesn't work on  and  for performance reasons.elem 'x' ("abc" :: String)False!elem False (one True :: Set Bool) ...D " Do not use 'elem' and 'notElem' methods from 'Foldable' on Set Suggestions: Instead of< elem :: (Foldable t, Eq a) => a -> t a -> Bool use# member :: ??? -- TODO... Instead of? notElem :: (Foldable t, Eq a) => a -> t a -> Bool use& notMember :: ??? -- TODO...reludeLike X but doesn't work on  and  for performance reasons.notElem 'x' ("abc" :: String)True$notElem False (one True :: Set Bool) ...D " Do not use 'elem' and 'notElem' methods from 'Foldable' on Set Suggestions: Instead of< elem :: (Foldable t, Eq a) => a -> t a -> Bool use# member :: ??? -- TODO... Instead of? notElem :: (Foldable t, Eq a) => a -> t a -> Bool use& notMember :: ??? -- TODO...reludeMonadic version of .andM [Just True, Just False] Just FalseandM [Just True] Just True%andM [Just True, Just False, Nothing] Just FalseandM [Just True, Nothing]NothingZandM [putTextLn "1" >> pure True, putTextLn "2" >> pure False, putTextLn "3" >> pure True]12FalsereludeMonadic version of .orM [Just True, Just False] Just TrueorM [Just True, Nothing] Just TrueorM [Nothing, Just True]NothingreludeMonadic version of .,allM (readMaybe >=> pure . even) ["6", "10"] Just True-allM (readMaybe >=> pure . even) ["5", "aba"] Just False.allM (readMaybe >=> pure . even) ["aba", "10"]NothingreludeMonadic version of .,anyM (readMaybe >=> pure . even) ["5", "10"] Just True.anyM (readMaybe >=> pure . even) ["10", "aba"] Just True.anyM (readMaybe >=> pure . even) ["aba", "10"]Nothing>(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>NoneFaI<=(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>NoneHVU reludeModifiable Map.reludeWRead-only map or set. Contains polymorphic functions which work for both sets and maps.reludeOperator version of  function.relude Inverse of  function.reludexReturn the value to which the specified key is mapped, or the default value if this map contains no mapping for the key.relude:Converts the structure to the list of the key-value pairs.7toPairs (HashMap.fromList [('a', "xxx"), ('b', "yyy")])[('a',"xxx"),('b',"yyy")]relude/Converts the structure to the list of the keys.4keys (HashMap.fromList [('a', "xxx"), ('b', "yyy")])"ab"relude1Converts the structure to the list of the values.5elems (HashMap.fromList [('a', "xxx"), ('b', "yyy")]) ["xxx","yyy"]reludeDefault value to return.relude Key to searchreludeContainer to search9 (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>None\E reludeLifted version of Y.reludeLifted version of Z.reludeLifted version of [.reludeLifted version of \.reludeLifted version of ].reludeLifted version of ^.reludeLifted version of _.reludeLifted version of `.reludeLifted version of a.reludeLifted version of b.reludeLifted version of c.reludeLifted version of d.  !V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com> Trustworthy -.27HSXeR relude Similar to  but data type.relude Version of ?@ that leaves warning.relude Version of ?A that leaves warning.relude Version of ?B that leaves warning.relude Version of ?C that leaves warning.relude Version of ?D that leaves warning.relude Version of ?E that leaves warning.reludee that takes  as an argument.reludef, that leaves warning in code on every usage.  "(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>NoneXhreludeLifted version of FG.reludeLifted version of ,H.reludeLifted version of g.reludeLifted version of h.IV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Nonej' 789:;<=>?@ABCDEFGHIJKLMNVWXJV(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com> Trustworthym  !&*+ ,-]\[ZYXWVUTSRQPONM. yx/wvutsr012  3456~}|{z789:;(')<=>?@A"B#$%C`dDE_FaGHIJKLMNbcOghiPQRSTUVWXefYZ[\]^jklmnopqrstuxwv{zy~}|      !"$#%&'()*+,-./0123456789:;<=>?@ACBEDFGLKJIH^_`abcdefghijklmnopq      !3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghjiklmnopqsrtuvwxyz#?(c) 2014 Chris Allen, Edward Kmett (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe/_relude is X with a Left that is a Brelude Transform a  into an X.relude Transform an X into a . reludeExamples7let fa = Success (*3) :: Validation [Text] (Int -> Int)7let ga = Success (*4) :: Validation [Text] (Int -> Int)*let a = Success 1 :: Validation [Text] Int*let b = Success 7 :: Validation [Text] Int8let c = Failure ["Not correct"] :: Validation [Text] Int?let d = Failure ["Not correct either"] :: Validation [Text] Intfa <*> b Success 21fa <*> cFailure ["Not correct"] c *> d *> b,Failure ["Not correct","Not correct either"]liftA2 (+) a b Success 8liftA2 (+) a cFailure ["Not correct"]$(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeXkrelude'Gets a string representation of a type.NOTE: This must be used with TypeApplications language extension. typeName @()"()" typeName @Int"Int"typeName @String"[Char]"typeName @(Maybe Int) "Maybe Int"%(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeXreludeUnwraps value from newtype.%newtype Size = Size Int deriving Showun @Int (Size 5)5%un (Size 5) == length ['a', 'x', 'b']FalsereludeWraps value to newtype. Behaves exactly as I but has more meaningnful name in case you need to convert some value to newtype.,newtype Flag = Flag Bool deriving (Show, Eq)wrap False == Flag TrueFalserelude#Applies function to the content of newtype.. This function is not supposed to be used on newtype7s that are created with the help of smart constructors.$newtype Foo = Foo Bool deriving Showunder not (Foo True) Foo False&newtype Bar = Bar String deriving Show'under (filter (== 'a')) (Bar "abacaba") Bar "aaaa"reludeLift binary function for newtypes to work over underlying newtype representation.#under2 @(Sum Int) (<>) (3 :: Int) 47under2 @All (<>) True FalseFalserelude Version of  that works on newtypeAs parametrized by their representation. Provided for convenience.underF2 @Sum (<>) (3 :: Int) 47underF2 @Max (<>) 'p' 't''t'reludeCoercible composition&(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>NoneHVXrelude<Groups elements using results of the given function as keys.2groupBy even [1..6] :: HashMap Bool (NonEmpty Int)/fromList [(False,5 :| [3,1]),(True,6 :| [4,2])]relude Similar to % but keeps only one element as value.,groupOneBy even [1 .. 6] :: HashMap Bool IntfromList [(False,1),(True,2)]'7(c) 2011-2015 Edward Kmett (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe/k relude;The class of foldable data structures that cannot be empty.reludeTMap each element of the non-empty structure to a semigroup, and combine the results. foldMap1 SG.Sum (1 :| [2, 3, 4])Sum {getSum = 10}relude@Combine the elements of a non-empty structure using a semigroup.$fold1 (1 :| [2, 3, 4 :: SG.Sum Int])Sum {getSum = 10}&fold1 (4 :| [5, 10 :: SG.Product Int])Product {getProduct = 200}relude5Convert a non-empty data structre to a NonEmpty list.toNonEmpty (Identity 2)2 :| []relude0The first element of a non-empty data structure.head1 (1 :| [2, 3, 4])1relude/The last element of a non-empty data structure.last1 (1 :| [2, 3, 4])4relude2The largest element of a non-empty data structure.!maximum1 (32 :| [64, 8, 128, 16])128relude4The smallest elemenet of a non-empty data structure.!minimum1 (32 :| [64, 8, 128, 16])8relude7Strictly folds non-empty structure with given function f: 0foldl1' f [x0, x1, x2 ...] = f (f x0 x1) x2 ... &foldl1' (++) ([1,2] :| [[3,4], [5,6]]) [1,2,3,4,5,6]  ((c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>SafeXkp&reludeReturns all values of some * + in ascending order.Edata TrafficLight = Red | Blue | Green deriving (Show, Enum, Bounded)universe :: [TrafficLight][Red,Blue,Green]universe :: [Bool] [False,True]'relude inverseMap f< creates a function that is the inverse of a given function f. It does so by constructing  for every value f a). The implementation makes sure that the 9 is constructed only once and then shared for every call.-The complexity of reversed mapping though is \mathcal{O}(\log n).Usually you want to use ' to inverse x function.>data Color = Red | Green | Blue deriving (Show, Enum, Bounded)0parse = inverseMap show :: String -> Maybe Color parse "Red"Just Red parse "Black"Nothing(reludeLike , but doesn't fail on . Instead it returns . next FalseTrue next TrueFalse succ True3*** Exception: Prelude.Enum.Bool.succ: bad argument)reludeLike , but doesn't fail on . Instead it returns . prec FalseTrue prec TrueFalse pred False3*** Exception: Prelude.Enum.Bool.pred: bad argument*reludeReturns b if given G outside range.safeToEnum @Bool 0 Just FalsesafeToEnum @Bool 1 Just TruesafeToEnum @Bool 2NothingsafeToEnum @Bool (-1)Nothing&'()*&'()*)(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe+reludedThis function returns the name of its caller function, but it requires that the caller function has # constraint. Otherwise, it returns " unknown".,foo :: HasCallStack => String; foo = ownNamefoo"foo"(bar :: HasCallStack => String; bar = foobar"foo",reludeThis function returns the name of its caller of the caller function, but it requires that the caller function and caller of the caller function have # constraint. Otherwise, it returns " unkown". It's useful for logging:Qlog :: HasCallStack => String -> IO (); log s = putStrLn $ callerName ++ ":" ++ sggreeting :: HasCallStack => IO (); greeting = log "Starting..." >> putStrLn "Hello!" >> log "Ending..."greetinggreeting:Starting...Hello!greeting:Ending...+,+,*(c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Safe-relude0Fmaps functions for nested bifunctor. Short for fmap (bimap f g).,bimapF not length $ Just (False, ['a', 'b']) Just (True,2).relude Short for  fmap . first.%firstF not $ Just (False, ['a', 'b'])Just (True,"ab")/relude Short for  fmap . second.*secondF length $ Just (False, ['a', 'b'])Just (False,2)-./-./V(c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikMITKowainik <xrom.xkov@gmail.com>Unsafe0relude Similar to  but with flipped arguments.00iKLMNOPKQRKQSKTUKTVKLWKLXKLYNOZK[\K[]K^_K`aK`bK`cK`dNefNegK[hKLiKLjKLkKLlKmnKopK^qK^rK^sK^tKuvKwxKwyKwzKL{KL|KL}KL~KLKLKLKLK`K`NeKK^K^KLKLK[NeKK^K^KKKmKoKLKKKKKKLKLNNNNNKKKKKKNK^K^NNKKKKKNNNKNKNNNKKNKKNNNKK`K`KLKLKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKwKKKKKKKKKKKK K K K K KKKKKKKKKKKKKKKKK K!K"K#K$K%&K%'K()K(*K+Ku,Ku-Ku.Ku/Ku0Ku1Ku2Ku3Ku4Ku5Ku6Ku7K8K9K:K;K<K=K>K?@K?AK?BK?BKCDKEFKEGKEGKHIKJKKJLKMNKMOKPQKPRKPSKPTKPUKJVKWXKYZK[\K[]K^_K^`K^aK^bK^cKdeKdfKdfKgKhKiKjKkKlKmKnKoKpKqKrKsKtKuKvKwKxKyKzK{K|K}~K}K}K}K}K}KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK^K^K^K^K^K^K^K^K^K^K^K^K^K^K^K^K^K^K^K^K^K`K`K`K`K`K`KKQKQKQKQKQKQKQKQKQKQ KQ KQ KQ KQ KQKQKQKQKQ KQ!KQ"KQKQ#KKKKKKKKKKTKTKTK !K["K[#K[$K[%K[&K'(KL)KL*KL+KL,KL-KL-KL.KL/KL0KL1KL2KL3KL4KL5KL6KL7KL8KL9KL:KL;KL<KL=KL>KL?KL@KLAKLBKCKDKEK^_NeFNeGNeHNeINeJNeKNeLNeMNeNNeOPQ6RSTRUVRWXRYZR[\]^_]^`]^a]^b]^cdefdeghijhikhlmhlnopqopropsoptopuopvopwoxyoxzox{ox|ox}h~h~h~hhhhhhhhhhhhhhhhhFFFF8hhhhh             0123         9      !"#$%&'()*+,-.//0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde f g h i j k l m n o p q!r!r!@!A!B!C!D!E!s!t!u!v!w!x!y!z!{!|"G"H"}"~################$%%%%%%&&'''''''''''''''((((())***K K K K KK K K K KPKPKPKWKWKWKKKKKKHKHKH8KP6}~}~P}P~P5}P~KYKDKEKFKGPPPP5P5P5KsKtKH}KH~#relude-0.4.0-Lxt6LRLYnzv5tbWxOcbEciRelude.List.Reexport Relude.BaseRelude.Container.ReexportRelude.Bool.ReexportRelude.FunctionRelude.Monad.ReexportRelude.Functor.ReexportRelude.String.Reexport Relude.MonoidRelude.ApplicativeRelude.Foldable.ReexportRelude.Lifted.ConcurrentRelude.Lifted.IORefRelude.ExceptionRelude.Monad.EitherRelude.Functor.Fmap Relude.UnsafeRelude.DeepSeqRelude.Container.OneRelude.Extra.TupleRelude.Lifted.ExitRelude.Monad.MaybeRelude.Lifted.FileRelude.Monad.Trans Relude.NubRelude.String.Conversion Relude.PrintRelude.List.NonEmptyRelude.Bool.GuardRelude.Foldable.FoldRelude.Extra.Map Relude.File Relude.DebugRelude.Lifted.TerminalRelude.Extra.ValidationRelude.Extra.TypeRelude.Extra.NewtypeRelude.Extra.GroupRelude.Extra.Foldable1Relude.Extra.EnumRelude.Extra.CallStackRelude.Extra.BifunctorRelude.ContainerPreludeidRelude.Functor System.ExitexitWith exitFailure exitSuccessdienubData.ByteString.Lazy ByteStringData.Text.LazyTextshow Relude.String Relude.Monad Relude.List Relude.BoolRelude.Foldable Debug.Tracetrace traceShow traceShowId traceShowMtraceMtraceId Data.TextgetLineprint Relude.LiftedReludebaseGHC.Base++ghc-primGHC.PrimseqGHC.Listfilterzip Data.Tuplefstsnd otherwisemap$coerceGHC.Num fromInteger-GHC.Real fromRationalGHC.EnumenumFrom enumFromThen enumFromToenumFromThenTo GHC.Classes==>=negate>>=>>fmapreturnControl.Monad.Failfail Data.String fromString fromIntegral realToFrac toInteger toRational Control.MonadguardGHC.ExtsIsListfromList fromListN<>memptymappendmconcatjoin<*>pure*>BoundedEnumEq GHC.FloatFloating FractionalIntegralMonadFunctorNumOrdGHC.ReadReadRealRealFracGHC.ShowShowData.Typeable.InternalTypeable MonadFailIsString Applicative Data.FoldableFoldableData.Traversable Traversable GHC.GenericsGeneric GHC.TypeNatsKnownNatGHC.OverloadedLabelsIsLabel SemigroupMonoid GHC.TypesBoolCharDoubleFloatIntGHC.IntInt8Int16Int32Int64 integer-gmpGHC.Integer.TypeInteger GHC.NaturalNatural GHC.MaybeMaybeOrderingRatioRationalIOWordGHC.WordWord8Word16Word32Word64 Data.EitherEitherType ConstraintNatCmpNat CoercibleGHC.Stack.Types CallStackD#FalseF#NothingJustTrueLeftRightLTEQGTGHC.IO.Handle.TypesHandleboundedEnumFromThenboundedEnumFrommaxIntminIntData.Functor.ContravariantcomparisonEquivalencedefaultEquivalencedefaultComparison>$$<>$<$<phantom>$ contramap Contravariant getPredicate Predicate getComparison ComparisongetEquivalence EquivalencegetOpOpData.Functor.Compose getComposeCompose Data.VoidvacuousabsurdVoidData.Semigroup mtimesDefaultcycle1 WrappedMonoid getOptionOptionsortWithData.BitraversablebifoldMapDefault bimapDefaultbifor bisequence bitraverse BitraversableData.BifoldablebifindbiallbianybiorbiandbielembilengthbinullbiListbiasum bisequence_bifor_ bitraverse_bifoldlMbifoldl'bifoldrMbifoldr'bifoldlbifoldr bifoldMapbifold BifoldableData.Bifunctorsecondfirstbimap BifunctorData.List.NonEmptyinitlasttailheadnonEmptyGHC.ExecutionStackshowStackTrace getStackTraceControl.Monad.IO.ClassliftIOMonadIO fromLabelmfilter<$!>unless replicateM_ replicateM zipWithM_zipWithM mapAndUnzipMforever<=<>=>filterM mapAccumR mapAccumLforMsequencemapM sequenceAtraverseControl.Applicativeoptional getZipListZipList Control.Arrow&&&Data.Functor.Identity runIdentityIdentity System.IOwithFileGHC.IO.Handle.FDstderrstdin GHC.StackwithFrozenCallStack callStack GHC.Conc.Sync writeTVarreadTVarnewTVarSTMTVarstdout GHC.IORefIORefGHC.IOFilePath GHC.ExceptionprettyCallStack prettySrcLocGHC.Exception.Type SomeExceptiondisplayException fromException toException ExceptionData.Functor.ConstgetConstConstfindallanyorand concatMapconcatasum sequence_ sequenceA_forM_mapM_for_ traverse_foldlMlengthnulltoListfoldl'foldrfoldMapfold Data.MonoidgetFirstFirstgetLastLastData.Semigroup.Internal stimesMonoidstimesIdempotentgetDualDualappEndoEndogetAllAllgetAnyAnygetSumSum getProductProductgetAltAlt someNatValnatValSomeNat Data.OldListunfoldrsortOnsortBysort permutations subsequencestailsinitsgroupgenericReplicategenericSplitAt genericDrop genericTake genericLength transpose intercalate intersperse isPrefixOf Text.Read readMaybereads fromRightfromLeftisRightisLeftpartitionEithersrightsleftseitherData.Ord comparingDown Data.ProxyProxyControl.Category>>><<< GHC.IO.IOMode ReadWriteMode AppendMode WriteModeReadModeIOModeatanhacoshasinhtanhcoshsinhatanacosasintancossinlogBase**sqrtexppi byteSwap64 byteSwap32 byteSwap16 Data.Bitsxor Data.Boolbool Data.Function&onfix Data.Functorvoid$><&><$>lcmgcd^^^oddeven denominator numeratordivModquotRemmoddivremquotrecip/floorceilingroundtruncateproperFractionmaxBoundminBoundfromEnumtoEnumpredsuccGHC.Charchrunzip3unzipzipWithzip3!!reversebreaksplitAtdroptake dropWhile takeWhilecycle replicaterepeatiteratescanrscanluncons Data.MaybemapMaybe catMaybes listToMaybe maybeToList fromMaybefromJust isNothingisJustmaybeswapuncurrycurryGHC.MVarMVarsubtractsignumabs*+ GHC.Stack.CCScurrentCallStackasTypeOf$!flip.constordwhen=<<liftA3<**>stimessconcat<$<*liftA2manysome<|>empty Alternativemplusmzero MonadPlus:|NonEmptyString getCallStack HasCallStackstimesIdempotentMonoid/=<=compare&&||not<>maxminbytestring-0.10.8.2Data.ByteString.Internalcontainers-0.6.0.1Data.IntMap.InternalIntMapData.IntSet.InternalIntSetData.Map.InternalMapData.Sequence.InternalSeqData.Set.InternalSetdeepseq-1.4.4.0Control.DeepSeqforce$!!deepseqrnfNFData'hashable-1.2.7.0-2SI038axTEd7AEZJ275kpiData.Hashable.Class hashWithSaltHashabletransformers-0.5.5.0Control.Monad.Trans.Classlift MonadTransControl.Monad.Trans.Identity runIdentityT IdentityT mtl-2.2.2Control.Monad.State.Classgetsmodify'modifystateputget MonadStateControl.Monad.Reader.Classasksreaderlocalask MonadReaderControl.Monad.Trans.ExceptExceptT runExceptTControl.Monad.Trans.ReaderReaderT runReaderTReader runReader withReader withReaderT Control.Monad.Trans.State.StrictStateT runStateTStaterunState evalState execState withState evalStateT execStateT stm-2.5.0.0Control.Concurrent.STM.TVar modifyTVar' text-1.2.3.1unwordsunlineslineswordsData.Text.Encoding decodeUtf8'decodeUtf8WithData.Text.InternalData.Text.Encoding.Error lenientDecode strictDecodeOnError OnDecodeErrorUnicodeExceptionControl.Monad.Trans.MaybeexceptToMaybeTmaybeToExceptT runMaybeTMaybeT2unordered-containers-0.2.9.0-I6OVG4HR3i6hFXdo933Hb Data.HashSetHashSetData.HashMap.BaseHashMappassOneOneItemone $fOneIntSet $fOneHashSet$fOneSet $fOneIntMap $fOneHashMap$fOneMap$fOneByteString$fOneByteString0 $fOneText $fOneText0$fOneSeq $fOneNonEmpty$fOne[]dupemapToFstmapToSndmapBothidentity<<$>>flap?? newEmptyMVarnewMVarputMVarreadMVarswapMVartakeMVar tryPutMVar tryReadMVar tryTakeMVar atomically newTVarIO readTVarIOnewIORef readIORef writeIORef modifyIORef modifyIORef'atomicModifyIORefatomicModifyIORef'atomicWriteIORef?:whenJust whenJustM whenNothing whenNothing_ whenNothingM whenNothingM_readFile writeFile appendFile usingReaderT usingReader usingStateT usingStateevaluatingStateTevaluatingStateexecutingStateTexecutingState hoistMaybe hoistEither maybeToMonoidordNubhashNubsortNub unstableNub LazyStricttoLazytoStrictToStringtoStringToLTexttoLTextToTexttoText ConvertUtf8 encodeUtf8 decodeUtf8decodeUtf8Strict LByteStringLText readEitherfromLazy fromStrict$fConvertUtf8TextByteString$fConvertUtf8TextByteString0$fConvertUtf8[]ByteString$fConvertUtf8TextByteString1$fConvertUtf8TextByteString2$fConvertUtf8[]ByteString0 $fToTextText $fToTextText0 $fToText[] $fToLTextText$fToLTextText0 $fToLText[]$fToStringText$fToStringText0 $fToString[]$fLazyStrictTextText $fLazyStrictByteStringByteStringputText putTextLnputLText putLTextLnputBSputBSLnputLBSputLBSLn leftToMaybe rightToMaybe maybeToRight maybeToLeftwhenLeft whenLeft_ whenLeftM whenLeftM_ whenRight whenRight_ whenRightM whenRightM_$fMonadFailEither viaNonEmpty whenNotNull whenNotNullMBugExcbug$fExceptionBug $fShowBug evaluateWHNF evaluateWHNF_ evaluateNF evaluateNF_whenMunlessMifMguardM&&^||^ElemErrorMessage DisallowElem flipfoldl'foldMapAasumMapfoldMapMsumproductelemnotElemandMorMallManyM DynamicMapinsert insertWithdeletealter StaticMapKeyValsizelookupmember!? notMember lookupDefaulttoPairskeyselems$fStaticMapIntSet$fStaticMapHashSet$fStaticMapSet$fStaticMapIntMap$fStaticMapHashMap$fStaticMapMap$fDynamicMapIntMap$fDynamicMapHashMap$fDynamicMapMap readFileText writeFileTextappendFileText readFileLTextwriteFileLTextappendFileLText readFileBS writeFileBS appendFileBS readFileLBS writeFileLBS appendFileLBS Undefinederror undefined $fEqUndefined$fOrdUndefined$fShowUndefined$fReadUndefined$fEnumUndefined$fBoundedUndefined$fDataUndefined$fGenericUndefinedputStrputStrLn ValidationFailureSuccessvalidationToEithereitherToValidation$fBitraversableValidation$fBifoldableValidation$fBifunctorValidation$fTraversableValidation$fFoldableValidation$fAlternativeValidation$fApplicativeValidation$fFunctorValidation$fEqValidation$fOrdValidation$fShowValidationtypeNameunwrapunderunder2underF2#.groupBy groupOneBy Foldable1foldMap1fold1 toNonEmptyhead1last1maximum1minimum1foldl1'$fFoldable1Sum$fFoldable1Product$fFoldable1Compose$fFoldable1(,)$fFoldable1Identity$fFoldable1NonEmptyuniverse inverseMapnextprec safeToEnumownName callerNamebimapFfirstFsecondFatControl.Concurrent.MVar Data.IORefData.Text.Internal.LazyData.ByteString.Lazy.Internal Data.Text.IOData.Text.Lazy.IOData.ByteStringData.ByteString.Char8Data.ByteString.Lazy.Char8 impureThrowevaluateGHC.Err