on is:module -package:saltine
One is a typeclass for creating structures from a singleton
element. It has three main goals:
- Give a shorter name for the construction: uses one instead
of common singleton.
- Work with monomorphic structures like Text or
IntSet.
- Give a clearer and less scary name for cases where you can use
pure or (:[]).
A
Once struct controls a one-time initialization function. Any
one-time initialization function must have its own unique
Once
struct.
Since: 2.4
Deprecated: Use Data.Tuple.Solo
Control workspaces on different screens (in xinerama mode).
Configure layouts on a per-host basis: use layouts and apply layout
modifiers selectively, depending on the host. Heavily based on
XMonad.Layout.PerWorkspace by Brent Yorgey.
Provides layout named OneBig. It places one (master) window at top
left corner of screen, and other (slave) windows at top
All functions without postfix are for instances of
Generic,
and functions with postfix
1 are for instances of
Generic1 (with kind
Type -> Type) which get an
extra argument to specify how to deal with the parameter. Functions
with postfix
01 are also for
Generic1 but they get
yet another argument that, like the
Generic functions, allows
handling of constant leaves. The function
createA_ does not
require any such instance, but must be given a constructor explicitly.
This module expors single polymorphic function
once, that
allows you to memoize IO actions and functions, evaluating them at
most once. Here is example:
>>> let mkStamp = (putStrLn "stamping" >> writeFile "/tmp/stamp" "") :: IO ()
>>> -- onceStamp :: IO ()
>>> onceStamp <- once mkStamp
>>> -- onceStamp actually evaluates mkStamp it wraps first time.
>>> onceStamp
stamping
>>> -- but second time result `()' is memoized, no action is performed.
>>> onceStamp
>>> -- we can memoize functions too
>>> foo <- once $ \x -> print "foo" >> print (x :: Int)
>>> -- action will be performed once for every distinct argument
>>> foo 10
foo
10
>>> foo 10
10
>>> foo 4
foo
4
Derived methods for
Bounded, using
Generics.OneLiner and
GHC.Generics.
Can be used for any types (deriving
Generic) where every field
is an instance of
Bounded.
Also includes a newtype wrapper that imbues any such data type with an
instant
Bounded instance, which can one day be used with
DerivingVia syntax to derive instances automatically.
Derived methods for
Semigroup and
Monoid, using
Generics.OneLiner and
GHC.Generics.
Can be used for any types (deriving
Generic) made with a single
constructor, where every field is an instance of
Semigroup (or
Monoid, depending on the function).
Also includes a newtype wrapper that imbues any such data type with
instant
Semigroup and
Monoid instances, which can one
day be used with
DerivingVia syntax to derive instances
automatically.
Derived methods for
Eq and
Ord, using
Generics.OneLiner and
GHC.Generics.
Can be used for any types (deriving
Generic) where every field
is an instance of
Eq (or
Ord).
Also includes a newtype wrapper that imbues any such data type with
instant
Eq and
Ord instances, which can one day be used
with
DerivingVia syntax to derive instances automatically.
Derived methods for numeric typeclasses, using
Generics.OneLiner and
GHC.Generics.
Can be used for any types (deriving
Generic) made with a single
constructor, where every field is an instance of
Num (or
Fractional or
Floating, depending on the function).
Also includes a newtype wrapper that imbues any such data type with an
instant
Num (and
Fractional and
Floating)
instance, which can one day be used with
DerivingVia syntax to
derive instances automatically.
Derived methods for
Random, using
Generics.OneLiner and
GHC.Generics.
Can be used for any types (deriving
Generic) made with a single
constructor, where every field is an instance of
Random.
Also includes a newtype wrapper that imbues any such data type with
instant
Random instances, which can one day be used with
DerivingVia syntax to derive instances automatically.
Derived methods for
Uniform, using
Generics.OneLiner and
GHC.Generics.
Can be used for any types (deriving
Generic) made with a single
constructor, where every field is an instance of
Uniform.
Also includes a newtype wrapper that imbues any such data type with
instant
Uniform instances, which can one day be used with
DerivingVia syntax to derive instances automatically.
Simple combinators working solely on and with functions.
A common interface to a collection of useful concurrency abstractions.
This module provides support for raising and catching both built-in
and user-defined exceptions.
In addition to exceptions thrown by
IO operations, exceptions
may be thrown by pure code (imprecise exceptions) or by external
events (asynchronous exceptions), but may only be caught in the
IO monad. For more details, see:
- A semantics for imprecise exceptions, by Simon Peyton
Jones, Alastair Reid, Tony Hoare, Simon Marlow, Fergus Henderson, in
PLDI'99.
- Asynchronous exceptions in Haskell, by Simon Marlow, Simon
Peyton Jones, Andy Moran and John Reppy, in PLDI'01.
- An Extensible Dynamically-Typed Hierarchy of Exceptions, by
Simon Marlow, in Haskell '06.