Copyright | (c) Donnacha Oisín Kidney 2018 |
---|---|
License | MIT |
Maintainer | mail@doisinkidney.com |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
WARNING
This module is considered internal.
The Package Versioning Policy does not apply.
This contents of this module may change in any way whatsoever and without any warning between minor versions of this package.
Authors importing this module are expected to track development closely.
Description
This module exports some utility functions common to both tree modules.
- data Drawing
- toDrawing :: (a -> String) -> (t -> Maybe (a, t, t)) -> t -> Drawing
- runDrawing :: Drawing -> ShowS
- drawTree :: (a -> String) -> (t -> Maybe (a, t, t)) -> t -> ShowS
- newtype State s a = State {
- runState :: s -> (a, s)
- evalState :: State s a -> s -> a
- newtype Identity a :: * -> * = Identity {
- runIdentity :: a
Drawing Trees
An abstract representation of a textual drawing of a tree.
toDrawing :: (a -> String) -> (t -> Maybe (a, t, t)) -> t -> Drawing Source #
Convert a tree to the Drawing type. This function is exposed so that users
may replace the call to runDrawing
in drawTree
with a more efficient
implementation that could use (for example) Text
.
runDrawing :: Drawing -> ShowS Source #
A function to convert a drawing to a string.
drawTree :: (a -> String) -> (t -> Maybe (a, t, t)) -> t -> ShowS Source #
Given an uncons function for a binary tree, draw the tree in a structured, human-readable way.
State
A clone of Control.Monad.State.Strict, reimplemented here to avoid the dependency.
Reimplementations for older GHCs
newtype Identity a :: * -> * #
Identity functor and monad. (a non-strict monad)
Since: 4.8.0.0
Identity | |
|
Monad Identity | Since: 4.8.0.0 |
Functor Identity | Since: 4.8.0.0 |
MonadFix Identity | Since: 4.8.0.0 |
Applicative Identity | Since: 4.8.0.0 |
Foldable Identity | Since: 4.8.0.0 |
Traversable Identity | |
Eq1 Identity | Since: 4.9.0.0 |
Ord1 Identity | Since: 4.9.0.0 |
Read1 Identity | Since: 4.9.0.0 |
Show1 Identity | Since: 4.9.0.0 |
MonadZip Identity | Since: 4.8.0.0 |
NFData1 Identity | Since: 1.4.3.0 |
Bounded a => Bounded (Identity a) | |
Enum a => Enum (Identity a) | |
Eq a => Eq (Identity a) | |
Floating a => Floating (Identity a) | |
Fractional a => Fractional (Identity a) | |
Integral a => Integral (Identity a) | |
Data a => Data (Identity a) | Since: 4.9.0.0 |
Num a => Num (Identity a) | |
Ord a => Ord (Identity a) | |
Read a => Read (Identity a) | This instance would be equivalent to the derived instances of the
Since: 4.8.0.0 |
Real a => Real (Identity a) | |
RealFloat a => RealFloat (Identity a) | |
RealFrac a => RealFrac (Identity a) | |
Show a => Show (Identity a) | This instance would be equivalent to the derived instances of the
Since: 4.8.0.0 |
Ix a => Ix (Identity a) | |
Generic (Identity a) | |
Semigroup a => Semigroup (Identity a) | Since: 4.9.0.0 |
Monoid a => Monoid (Identity a) | |
Storable a => Storable (Identity a) | |
Bits a => Bits (Identity a) | |
FiniteBits a => FiniteBits (Identity a) | |
NFData a => NFData (Identity a) | Since: 1.4.0.0 |
Generic1 * Identity | |
type Rep (Identity a) | |
type Rep1 * Identity | |