aoc2019-0.1.0.0: Development environment for Advent of Code challenges

Copyright(c) Justin Le 2018
LicenseBSD3
Maintainerjustin@jle.im
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

AOC.Util

Description

Assorted utility functions and orphans used for solutions.

Synopsis

Documentation

strip :: String -> String Source #

Strip trailing and leading whitespace.

stripNewline :: String -> String Source #

Strip trailing newline

eitherToMaybe :: Alternative m => Either e a -> m a Source #

Convert an Either into a Maybe, or any Alternative instance, forgetting the error value.

firstJust :: Foldable t => (a -> Maybe b) -> t a -> Maybe b Source #

Like find, but instead of taking an a -> Bool, takes an a -> Maybe b and returns the first success.

maybeToEither :: MonadError e m => e -> Maybe a -> m a Source #

Convert a Maybe into an Either, or any MonadError instance, by providing an error value in case Nothing was given.

maybeAlt :: Alternative m => Maybe a -> m a Source #

Generalize a Maybe to any Alternative

traceShowIdMsg :: Show a => String -> a -> a Source #

Like traceShowId but with an extra message

traceShowMsg :: Show a => String -> a -> b -> b Source #

Like traceShow but with an extra message