aoc2018-0.1.0.0: Advent of Code 2018 solutions and auto-runner

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.

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

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

findMaybe :: 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.