louse-0.1.0.0: A distributed bug tracking program

CopyrightCopyright (c) 2015, Peter Harpending.
LicenseGPL-3
MaintainerPeter Harpending <peter@harpending.org>
Stabilityexperimental
PortabilityUNIX/GHC
Safe HaskellSafe
LanguageHaskell2010

Development.Louse

Contents

Description

This is the top-level module for the louse library. You only need to import this module, everything else will automatically be re-exported.

Since: 0.1.0.0

Synopsis

Convenience re-exports

Creating pure-ish bugs

data Bug Source

The type for a bug

Since: 0.1.0.0

Instances

Eq Bug Source 
Show Bug Source 
FromBug Bug Source

Bug is trivially an instance of FromBug

Since: 0.1.0.0

ToBug Bug Source

Bug is trivially an instance of ToBug

Bug titles

data Title Source

A newtype over Text. Haskell doesn't have dependent types, so I have to use a hack called "smart constructors" to make sure

0 < title_length <= 64

Use mkTitle to make a title. Alternatively, you could turn on OverloadedStrings, and use Title's IsString instance:

>>> :set -XOverloadedStrings
>>> "hello" :: Title
Title {unTitle = "hello"}
it :: Title

Note that if you give invalid input, then there will be an error:

>>> "" :: Title
*** Exception: Title mustn't be empty.
>>> fromString (mconcat (replicate 50 "foo")) :: Title
*** Exception: Title mustn't be >64 characters long.

Since: 0.1.0.0

Instances

Eq Title Source 
Ord Title Source

Compares by the value of unTitle.

Since: 0.1.0.0

Show Title Source

Since: 0.1.0.0

IsString Title Source

Note that this will throw an error if you give it an invalid value.

Since: 0.1.0.0

mkTitle :: Text -> Exceptional Title Source

Attempt to make a title, returning an error message if the length is longer than 64 characters, or if the title is empty.

Since: 0.1.0.0

Bug descriptions

data Description Source

Yet another newtype over Text. This is to make sure the description is less than (or equal to) 8192 characters.

Use mkDescription to make a description. This is an instance of IsString, too, so, in pure code, you can just write plain strings, and turn on the OverloadedStrings extension.

>>> :set -XOverloadedStrings
>>> "hello" :: Description
Description {unDescription = "hello"}
it :: Description

If you give invalid input, then there will be an error:

>>> "" :: Description
*** Exception: Description mustn't be empty.

Since: 0.1.0.0

Instances

Eq Description Source 
Ord Description Source

Compares by the value of unDescription.

Since: 0.1.0.0

Show Description Source

Since: 0.1.0.0

IsString Description Source

Note that this will throw an error if given invalid input.

Since: 0.1.0.0

ToForest CommentTree (Author, CommentText) Source

Since: 0.1.0.0

mkDescription :: Text -> Exceptional Description Source

Attempt to make a description from a pure Text value. This returns an error if the description is empty.

Since: 0.1.0.0

People

data Person Source

Type for a person. Just has email and name

Since: 0.1.0.0

Constructors

Person 

Instances

Eq Person Source 
Show Person Source
>>> Person "Joe Q. Public" "jqp@foo.bar.baz"
Joe Q. Public <jqp@foo.bar.baz>
it :: Person

Since: 0.1.0.0

ToForest CommentTree (Author, CommentText) Source

Since: 0.1.0.0

type Author = Person Source

Alias for Person

Since: 0.1.0.0

type Reporter = Person Source

Alias for Person

Since: 0.1.0.0

Comments

data Comment Source

The type for a comment

Since: 0.1.0.0

Comment text

type CommentText = Description Source

Comment text has the same requirements as a Description, so alias the two

Since: 0.1.0.0

unCommentText :: CommentText -> Text Source

Alias for unDescription

Since: 0.1.0.0

Comment trees

data CommentTree Source

This is similar to a Tree from containers, except it's implemented using lazy HashMaps.

Specifically, this is a newtype over HashMap ByteString Comment. The idea being that the key

Since: 0.1.0.0

Converting to & from bugs

class ToBug a where Source

Typeclass to convert something to a Bug

Methods

toBug :: a -> Bug Source

Instances

ToBug Bug Source

Bug is trivially an instance of ToBug

class FromBug a where Source

Convert something from a Bug

Since: 0.1.0.0

Methods

fromBug :: Bug -> a Source

Instances

FromBug Bug Source

Bug is trivially an instance of FromBug

Since: 0.1.0.0

Converting to & from trees

class ToTree foo bar where Source

Convert something of type foo to a Tree of type bar.

Since: 0.1.0.0

Methods

toTree :: foo -> Tree bar Source

class FromTree bar foo where Source

Convert a Tree of type bars to something of type foo.

Since: 0.1.0.0

Methods

fromTree :: Tree bar -> foo Source

Forests are just lists of trees

class ToForest foo bar where Source

Convert something of type foo to a Forest of bars.

Since: 0.1.0.0

Methods

toForest :: foo -> Forest bar Source

Instances

ToForest CommentTree (Author, CommentText) Source

Since: 0.1.0.0

(ToTree foo bar, Foldable t) => ToForest (t foo) bar Source

Since: 0.1.0.0

class FromForest bar foo where Source

Convert a Forest of type bar to something of type foo.

Since: 0.1.0.0

Methods

fromForest :: Forest bar -> foo Source

Instances

FromTree bar foo => FromForest bar [foo] Source

Since: 0.1.0.0