eventstore-1.2.1: EventStore TCP Client

Copyright(C) 2014 Yorick Laupa
License(see the file LICENSE)
MaintainerYorick Laupa <yo.eight@gmail.com>
Stabilityprovisional
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Database.EventStore

Contents

Description

 
Synopsis

Connection

data Connection Source #

Represents a connection to a single EventStore node.

data ConnectionType Source #

Gathers every connection type handled by the client.

Constructors

Static String Int

HostName and Port.

Cluster ClusterSettings 
Dns ByteString (Maybe DnsServer) Int

Domain name, optional DNS server and port.

data Credentials Source #

Holds login and password information.

data Settings Source #

Global Connection settings

Constructors

Settings 

Fields

data Retry Source #

Represents reconnection strategy.

atMost :: Int -> Retry Source #

Indicates how many times we should try to reconnect to the server. A value less than or equal to 0 means no retry.

keepRetrying :: Retry Source #

Indicates we should try to reconnect to the server until the end of the Universe.

credentials Source #

Arguments

:: ByteString

Login

-> ByteString

Password

-> Credentials 

Creates a Credentials given a login and a password.

defaultSSLSettings :: TLSSettings -> Settings Source #

Default SSL settings based on defaultSettings.

connect :: Settings -> ConnectionType -> IO Connection Source #

Creates a new Connection to a single node. It maintains a full duplex connection to the EventStore. An EventStore Connection operates quite differently than say a SQL connection. Normally when you use an EventStore connection you want to keep the connection open for a much longer of time than when you use a SQL connection.

Another difference is that with the EventStore Connection all operations are handled in a full async manner (even if you call the synchronous behaviors). Many threads can use an EvenStore Connection at the same time or a single thread can make many asynchronous requests. To get the most performance out of the connection it is generally recommended to use it in this way.

shutdown :: Connection -> IO () Source #

Asynchronously closes the Connection.

waitTillClosed :: Connection -> IO () Source #

Waits the Connection to be closed.

Cluster Connection

data ClusterSettings Source #

Contains settings related to a connection to a cluster.

Constructors

ClusterSettings 

Fields

data DnsServer Source #

Tells how the DNS server should be contacted.

data GossipSeed Source #

Represents a source of cluster gossip.

gossipSeedWithHeader :: String -> Int -> String -> GossipSeed Source #

Creates a GossipSeed with a specific HTTP header.

gossipSeedHost :: GossipSeed -> String Source #

Returns GossipSeed host IP address.

gossipSeedHeader :: GossipSeed -> String Source #

The host header to be sent when requesting gossip.

gossipSeedClusterSettings :: NonEmpty GossipSeed -> ClusterSettings Source #

Configures a ClusterSettings for connecting to a cluster using gossip seeds. clusterDns = "" clusterMaxDiscoverAttempts = 10 clusterExternalGossipPort = 0 clusterGossipTimeout = 1s

dnsClusterSettings :: ByteString -> ClusterSettings Source #

Configures a ClusterSettings for connecting to a cluster using DNS discovery. clusterMaxDiscoverAttempts = 10 clusterExternalGossipPort = 0 clusterGossipSeeds = Nothing clusterGossipTimeout = 1s

Event

data Event Source #

Contains event information like its type and data. Only used for write queries.

Instances
Eq Event Source # 
Instance details

Defined in Database.EventStore.Internal.Types

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Show Event Source # 
Instance details

Defined in Database.EventStore.Internal.Types

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

data EventData Source #

Holds event data.

data EventType Source #

Constants for System event types.

Constructors

StreamDeletedType

Event type for stream deleted.

StatsCollectionType

Event type for statistics.

LinkToType

Event type for linkTo.

StreamMetadataType

Event type for stream metadata.

SettingsType

Event type for the system settings.

UserDefined Text

Event defined by the user.

createEvent Source #

Arguments

:: EventType

Event type

-> Maybe UUID

Event ID, generated if Nothing

-> EventData

Event data

-> Event 

Create an Event meant to be persisted.

withJson :: ToJSON a => a -> EventData Source #

Creates an event using JSON format

withJsonAndMetadata :: (ToJSON a, ToJSON b) => a -> b -> EventData Source #

Creates an event with metadata using JSON format.

withBinary :: ByteString -> EventData Source #

Creates an event using a binary format.

withBinaryAndMetadata :: ByteString -> ByteString -> EventData Source #

Creates an event with metadata using binary format.

Event number

streamStart :: EventNumber Source #

The first event in a stream.

streamEnd :: EventNumber Source #

The last event in the stream.

eventNumber :: Natural -> EventNumber Source #

the Nth event of a stream.

rawEventNumber :: Int64 -> EventNumber Source #

Returns a 'EventNumber from a raw Int64.

Common Operation types

Read Operations

data StreamMetadataResult Source #

Represents stream metadata as a series of properties for system data and a StreamMetadata object for user metadata.

Constructors

StreamMetadataResult 

Fields

NotFoundStreamMetadataResult

When the stream is either not found or 'no stream'.

Fields

DeletedStreamMetadataResult

When the stream is soft-deleted.

Fields

type family BatchResult t where ... Source #

When batch-reading a stream, this type-level function maps the result you will have whether you read a regular stream or $all stream. When reading a regular stream, some read-error can occur like the stream got deleted. However read-error cannot occur when reading $all stream (because $all cannot get deleted).

data ResolveLink Source #

Determines whether any link event encountered in the stream will be resolved. See the discussion for more information: https://eventstore.org/docs/dotnet-api/reading-events/index.html#resolvedevent

Constructors

ResolveLink 
NoResolveLink 

readEvent :: Connection -> StreamName -> EventNumber -> ResolveLink -> Maybe Credentials -> IO (Async (ReadResult EventNumber ReadEvent)) Source #

Reads a single event from given stream.

readEventsBackward Source #

Arguments

:: Connection 
-> StreamId t 
-> t 
-> Int32

Batch size

-> ResolveLink 
-> Maybe Credentials 
-> IO (Async (BatchResult t)) 

Reads events from a stream backward.

readEventsForward Source #

Arguments

:: Connection 
-> StreamId t 
-> t 
-> Int32

Batch size

-> ResolveLink 
-> Maybe Credentials 
-> IO (Async (BatchResult t)) 

Reads events from a stream forward.

getStreamMetadata :: Connection -> StreamName -> Maybe Credentials -> IO (Async StreamMetadataResult) Source #

Asynchronously gets the metadata of a stream.

Write Operations

data StreamACL Source #

Represents an access control list for a stream.

Constructors

StreamACL 

Fields

data StreamMetadata Source #

Represents stream metadata with strongly typed properties for system values and a dictionary-like interface for custom values.

Constructors

StreamMetadata 

Fields

getCustomPropertyValue :: StreamMetadata -> Text -> Maybe Value Source #

Gets a custom property value from metadata.

getCustomProperty :: FromJSON a => StreamMetadata -> Text -> Maybe a Source #

Get a custom property value from metadata.

emptyStreamACL :: StreamACL Source #

StreamACL with no role or users whatsoever.

deleteStream Source #

Arguments

:: Connection 
-> StreamName 
-> ExpectedVersion 
-> Maybe Bool

Hard delete

-> Maybe Credentials 
-> IO (Async DeleteResult) 

Deletes given stream.

sendEvents :: Connection -> StreamName -> ExpectedVersion -> [Event] -> Maybe Credentials -> IO (Async WriteResult) Source #

Sends a list of Event to given stream.

setStreamMetadata :: Connection -> StreamName -> ExpectedVersion -> StreamMetadata -> Maybe Credentials -> IO (Async WriteResult) Source #

Asynchronously sets the metadata for a stream.

Builder

type Builder a = Endo a Source #

Allows to build a structure using Monoid functions.

Stream ACL Builder

setReadRoles :: [Text] -> StreamACLBuilder Source #

Sets role names with read permission for the stream.

setReadRole :: Text -> StreamACLBuilder Source #

Sets a single role name with read permission for the stream.

setWriteRoles :: [Text] -> StreamACLBuilder Source #

Sets role names with write permission for the stream.

setWriteRole :: Text -> StreamACLBuilder Source #

Sets a single role name with write permission for the stream.

setDeleteRoles :: [Text] -> StreamACLBuilder Source #

Sets role names with delete permission for the stream.

setDeleteRole :: Text -> StreamACLBuilder Source #

Sets a single role name with delete permission for the stream.

setMetaReadRoles :: [Text] -> StreamACLBuilder Source #

Sets role names with metadata read permission for the stream.

setMetaReadRole :: Text -> StreamACLBuilder Source #

Sets a single role name with metadata read permission for the stream.

setMetaWriteRoles :: [Text] -> StreamACLBuilder Source #

Sets role names with metadata write permission for the stream.

setMetaWriteRole :: Text -> StreamACLBuilder Source #

Sets a single role name with metadata write permission for the stream.

Stream Metadata Builder

setMaxCount :: Int32 -> StreamMetadataBuilder Source #

Sets the maximum number of events allowed in the stream.

setMaxAge :: TimeSpan -> StreamMetadataBuilder Source #

Sets the maximum age of events allowed in the stream.

setTruncateBefore :: Int32 -> StreamMetadataBuilder Source #

Sets the event number from which previous events can be scavenged.

setCacheControl :: TimeSpan -> StreamMetadataBuilder Source #

Sets the amount of time for which the stream head is cachable.

setACL :: StreamACL -> StreamMetadataBuilder Source #

Overwrites any previous StreamACL by the given one in a StreamMetadataBuilder.

setCustomProperty :: ToJSON a => Text -> a -> StreamMetadataBuilder Source #

Sets a custom metadata property.

Transaction

data Transaction Source #

Represents a multi-request transaction with the EventStore.

startTransaction Source #

Arguments

:: Connection 
-> StreamName

Stream name

-> ExpectedVersion 
-> Maybe Credentials 
-> IO (Async Transaction) 

Starts a transaction on given stream.

transactionCommit :: Transaction -> Maybe Credentials -> IO (Async WriteResult) Source #

Asynchronously commits this transaction.

transactionRollback :: Transaction -> IO () Source #

There isn't such of thing in EventStore parlance. Basically, if you want to rollback, you just have to not transactionCommit a Transaction.

transactionWrite :: Transaction -> [Event] -> Maybe Credentials -> IO (Async ()) Source #

Asynchronously writes to a transaction in the EventStore.

Subscription

data SubDropReason Source #

Indicates why a subscription has been dropped.

Constructors

SubUnsubscribed

Subscription connection has been closed by the user.

SubAccessDenied

The current user is not allowed to operate on the supplied stream.

SubNotFound

Given stream name doesn't exist.

SubPersistDeleted

Given stream is deleted.

SubAborted

Occurs when the user shutdown the connection from the server or if the connection to the server is no longer possible.

SubNotAuthenticated (Maybe Text) 
SubServerError (Maybe Text)

Unexpected error from the server.

SubNotHandled !NotHandledReason !(Maybe MasterInfo) 
SubClientError !Text 
SubSubscriberMaxCountReached 

data SubDetails Source #

Subscription runtime details. Not useful for the user but at least it makes Haddock documentation generation less ugly.

waitConfirmation :: Subscription s => s -> IO () Source #

Waits until the Subscription has been confirmed.

waitUnsubscribeConfirmed :: Subscription s => s -> IO () Source #

Wait until unsubscription has been confirmed by the server.

nextEventMaybeSTM :: Subscription s => s -> STM (Maybe ResolvedEvent) Source #

Asks for the next incoming event like nextEventMaybe while still being in the the STM.

getSubscriptionDetailsSTM :: Subscription s => s -> STM SubDetails Source #

Returns the runtime details of a subscription.

unsubscribe :: Subscription s => s -> IO () Source #

Asynchronously unsubscribe from the the stream.

Volatile Subscription

data RegularSubscription t Source #

Also referred as volatile subscription. For example, if a stream has 100 events in it when a subscriber connects, the subscriber can expect to see event number 101 onwards until the time the subscription is closed or dropped.

getSubscriptionId :: Subscription s => s -> IO SubscriptionId Source #

Gets the ID of the subscription.

nextEvent :: Subscription s => s -> IO ResolvedEvent Source #

Awaits for the next event.

nextEventMaybe :: Subscription s => s -> IO (Maybe ResolvedEvent) Source #

Non blocking version of nextEvent.

Catch-up Subscription

data CatchupSubscription t Source #

This kind of subscription specifies a starting point, in the form of an event number or transaction file position. The given function will be called for events from the starting point until the end of the stream, and then for subsequently written events.

For example, if a starting point of 50 is specified when a stream has 100 events in it, the subscriber can expect to see events 51 through 100, and then any events subsequently written until such time as the subscription is dropped or closed.

subscribeFrom Source #

Arguments

:: Connection 
-> StreamId t 
-> ResolveLink 
-> Maybe t 
-> Maybe Int32

Batch size

-> Maybe Credentials 
-> IO (CatchupSubscription t) 

Subscribes to a stream. If last checkpoint is defined, this will readStreamEventsForward from that event number, otherwise from the beginning. Once last stream event reached up, a subscription request will be sent using subscribe.

waitTillCatchup :: CatchupSubscription t -> IO () Source #

Waits until CatchupSubscription subscription catch-up its stream.

Persistent Subscription

data PersistentSubscription Source #

The server remembers the state of the subscription. This allows for many different modes of operations compared to a regular or catchup subscription where the client holds the subscription state. (Need EventStore >= v3.1.0).

data PersistentSubscriptionSettings Source #

Gathers every persistent subscription property.

Constructors

PersistentSubscriptionSettings 

Fields

data SystemConsumerStrategy Source #

System supported consumer strategies for use with persistent subscriptions.

Constructors

DispatchToSingle

Distributes events to a single client until it is full. Then round robin to the next client.

RoundRobin

Distributes events to each client in a round robin fashion.

data PersistActionException Source #

Enumerates all persistent action exceptions.

Constructors

PersistActionFail

The action failed.

PersistActionAlreadyExist

Happens when creating a persistent subscription on a stream with a group name already taken.

PersistActionDoesNotExist

An operation tried to do something on a persistent subscription or a stream that don't exist.

PersistActionAccessDenied

The current user is not allowed to operate on the supplied stream or persistent subscription.

PersistActionAborted

That action has been aborted because the user shutdown the connection to the server or the connection to the server is no longer possible.

acknowledge :: PersistentSubscription -> ResolvedEvent -> IO () Source #

Acknowledges that ResolvedEvent has been successfully processed.

acknowledgeEvents :: PersistentSubscription -> [ResolvedEvent] -> IO () Source #

Acknowledges those ResolvedEvents have been successfully processed.

failed :: PersistentSubscription -> ResolvedEvent -> NakAction -> Maybe Text -> IO () Source #

Mark a message that has failed processing. The server will take action based upon the action parameter.

eventsFailed :: PersistentSubscription -> [ResolvedEvent] -> NakAction -> Maybe Text -> IO () Source #

Mark messages that have failed processing. The server will take action based upon the action parameter.

notifyEventsProcessed :: PersistentSubscription -> [UUID] -> IO () Source #

Acknowledges those event ids have been successfully processed.

notifyEventsFailed :: PersistentSubscription -> NakAction -> Maybe Text -> [UUID] -> IO () Source #

Acknowledges those event ids have failed to be processed successfully.

defaultPersistentSubscriptionSettings :: PersistentSubscriptionSettings Source #

System default persistent subscription settings.

createPersistentSubscription :: Connection -> Text -> StreamName -> PersistentSubscriptionSettings -> Maybe Credentials -> IO (Async (Maybe PersistActionException)) Source #

Asynchronously create a persistent subscription group on a stream.

updatePersistentSubscription :: Connection -> Text -> StreamName -> PersistentSubscriptionSettings -> Maybe Credentials -> IO (Async (Maybe PersistActionException)) Source #

Asynchronously update a persistent subscription group on a stream.

deletePersistentSubscription :: Connection -> Text -> StreamName -> Maybe Credentials -> IO (Async (Maybe PersistActionException)) Source #

Asynchronously delete a persistent subscription group on a stream.

connectToPersistentSubscription :: Connection -> Text -> StreamName -> Int32 -> Maybe Credentials -> IO PersistentSubscription Source #

Asynchronously connect to a persistent subscription given a group on a stream.

Results

data Slice t Source #

Gathers common slice operations.

Constructors

SliceEndOfStream 
Slice ![ResolvedEvent] !(Maybe t) 
Instances
Functor Slice Source # 
Instance details

Defined in Database.EventStore.Internal.Operation.Read.Common

Methods

fmap :: (a -> b) -> Slice a -> Slice b #

(<$) :: a -> Slice b -> Slice a #

Show t => Show (Slice t) Source # 
Instance details

Defined in Database.EventStore.Internal.Operation.Read.Common

Methods

showsPrec :: Int -> Slice t -> ShowS #

show :: Slice t -> String #

showList :: [Slice t] -> ShowS #

sliceEvents :: Slice t -> [ResolvedEvent] Source #

Gets slice's ResolvedEventss.

sliceEOS :: Slice t -> Bool Source #

If the slice has reached the end of the stream.

sliceNext :: Slice t -> Maybe t Source #

Gets the next location of this slice.

emptySlice :: Slice t Source #

Empty slice.

type AllSlice = Slice Position Source #

Represents a slice of the $all stream.

data WriteResult Source #

Returned after writing to a stream.

Constructors

WriteResult 

Fields

data ReadResult t a where Source #

Enumeration detailing the possible outcomes of reading a stream.

Instances
Functor (ReadResult t) Source # 
Instance details

Defined in Database.EventStore.Internal.Operation.Read.Common

Methods

fmap :: (a -> b) -> ReadResult t a -> ReadResult t b #

(<$) :: a -> ReadResult t b -> ReadResult t a #

Foldable (ReadResult t) Source # 
Instance details

Defined in Database.EventStore.Internal.Operation.Read.Common

Methods

fold :: Monoid m => ReadResult t m -> m #

foldMap :: Monoid m => (a -> m) -> ReadResult t a -> m #

foldr :: (a -> b -> b) -> b -> ReadResult t a -> b #

foldr' :: (a -> b -> b) -> b -> ReadResult t a -> b #

foldl :: (b -> a -> b) -> b -> ReadResult t a -> b #

foldl' :: (b -> a -> b) -> b -> ReadResult t a -> b #

foldr1 :: (a -> a -> a) -> ReadResult t a -> a #

foldl1 :: (a -> a -> a) -> ReadResult t a -> a #

toList :: ReadResult t a -> [a] #

null :: ReadResult t a -> Bool #

length :: ReadResult t a -> Int #

elem :: Eq a => a -> ReadResult t a -> Bool #

maximum :: Ord a => ReadResult t a -> a #

minimum :: Ord a => ReadResult t a -> a #

sum :: Num a => ReadResult t a -> a #

product :: Num a => ReadResult t a -> a #

Traversable (ReadResult t) Source # 
Instance details

Defined in Database.EventStore.Internal.Operation.Read.Common

Methods

traverse :: Applicative f => (a -> f b) -> ReadResult t a -> f (ReadResult t b) #

sequenceA :: Applicative f => ReadResult t (f a) -> f (ReadResult t a) #

mapM :: Monad m => (a -> m b) -> ReadResult t a -> m (ReadResult t b) #

sequence :: Monad m => ReadResult t (m a) -> m (ReadResult t a) #

Eq a => Eq (ReadResult t a) Source # 
Instance details

Defined in Database.EventStore.Internal.Operation.Read.Common

Methods

(==) :: ReadResult t a -> ReadResult t a -> Bool #

(/=) :: ReadResult t a -> ReadResult t a -> Bool #

Show a => Show (ReadResult t a) Source # 
Instance details

Defined in Database.EventStore.Internal.Operation.Read.Common

Methods

showsPrec :: Int -> ReadResult t a -> ShowS #

show :: ReadResult t a -> String #

showList :: [ReadResult t a] -> ShowS #

data RecordedEvent Source #

Represents a previously written event.

Constructors

RecordedEvent 

Fields

data ReadEvent Source #

Represents the result of looking up a specific event number from a stream.

type StreamSlice = Slice EventNumber Source #

Regular stream slice.

data Position Source #

A structure referring to a potential logical record position in the EventStore transaction file.

Constructors

Position 

Fields

data ReadDirection Source #

Represents the direction of read operation (both from $all an usual streams).

Constructors

Forward

From beginning to end

Backward

From end to beginning

data ResolvedEvent Source #

A structure representing a single event or an resolved link event.

Constructors

ResolvedEvent 

Fields

data OperationError Source #

Operation exception that can occurs on an operation response.

Constructors

WrongExpectedVersion Text ExpectedVersion

Stream and Expected Version

StreamDeleted StreamName

Stream

InvalidTransaction 
AccessDenied (StreamId t)

Stream

InvalidServerResponse Command Command

Expected, Found

ProtobufDecodingError String 
ServerError (Maybe Text)

Reason

InvalidOperation Text 
StreamNotFound StreamName 
NotAuthenticatedOp

Invalid operation state. If happens, it's a driver bug.

Aborted

Occurs when the user asked to close the connection or if the connection can't reconnect anymore.

data StreamId loc where Source #

Represents a regular stream name or $all stream.

Instances
Eq (StreamId t) Source # 
Instance details

Defined in Database.EventStore.Internal.Stream

Methods

(==) :: StreamId t -> StreamId t -> Bool #

(/=) :: StreamId t -> StreamId t -> Bool #

Show (StreamId t) Source # 
Instance details

Defined in Database.EventStore.Internal.Stream

Methods

showsPrec :: Int -> StreamId t -> ShowS #

show :: StreamId t -> String #

showList :: [StreamId t] -> ShowS #

isAllStream :: StreamId t -> Bool Source #

If the stream is the $all stream.

isEventResolvedLink :: ResolvedEvent -> Bool Source #

Indicates whether this ResolvedEvent is a resolved link event.

resolvedEventOriginal :: ResolvedEvent -> RecordedEvent Source #

Returns the event that was read or which triggered the subscription.

If this ResolvedEvent represents a link event, the link will be the original event, otherwise it will be the event.

resolvedEventDataAsJson :: FromJSON a => ResolvedEvent -> Maybe a Source #

Tries to desarialize resolvedEventOriginal data as JSON.

resolvedEventOriginalStreamId :: ResolvedEvent -> Text Source #

The stream name of the original event.

resolvedEventOriginalId :: ResolvedEvent -> UUID Source #

The ID of the original event.

resolvedEventOriginalEventNumber :: ResolvedEvent -> Int64 Source #

The event number of the original event.

recordedEventDataAsJson :: FromJSON a => RecordedEvent -> Maybe a Source #

Tries to parse JSON object from the given RecordedEvent.

positionStart :: Position Source #

Representing the start of the transaction file.

positionEnd :: Position Source #

Representing the end of the transaction file.

Logging

data LogType #

Logger Type.

Constructors

LogNone

No logging.

LogStdout BufSize

Logging to stdout. BufSize is a buffer size for each capability.

LogStderr BufSize

Logging to stderr. BufSize is a buffer size for each capability.

LogFileNoRotate FilePath BufSize

Logging to a file. BufSize is a buffer size for each capability.

LogFile FileLogSpec BufSize

Logging to a file. BufSize is a buffer size for each capability. File rotation is done on-demand.

LogFileTimedRotate TimedFileLogSpec BufSize

Logging to a file. BufSize is a buffer size for each capability. Rotation happens based on check specified in TimedFileLogSpec.

LogCallback (LogStr -> IO ()) (IO ())

Logging with a log and flush action. run flush after log each message.

Misc

data Command Source #

Internal command representation.

data ExpectedVersion Source #

Constants used for expected version control.

The use of expected version can be a bit tricky especially when discussing idempotency assurances given by the EventStore.

The EventStore will assure idempotency for all operations using any value in ExpectedVersion except for anyStream. When using anyStream the EventStore will do its best to assure idempotency but will not guarantee idempotency.

anyVersion :: ExpectedVersion Source #

This write should not conflict with anything and should always succeed.

noStreamVersion :: ExpectedVersion Source #

The stream being written to should not yet exist. If it does exist treat that as a concurrency problem.

emptyStreamVersion :: ExpectedVersion Source #

The stream should exist and should be empty. If it does not exist or is not empty, treat that as a concurrency problem.

exactEventVersion :: Int64 -> ExpectedVersion Source #

States that the last event written to the stream should have a sequence number matching your expected value.

streamExists :: ExpectedVersion Source #

The stream should exist. If it or a metadata stream does not exist treat that as a concurrency problem.

msDiffTime :: Float -> NominalDiffTime Source #

Millisecond timespan

Re-export

(<>) :: Semigroup a => a -> a -> a infixr 6 #

An associative operation.

data NonEmpty a #

Non-empty (and non-strict) list type.

Since: base-4.9.0.0

Constructors

a :| [a] infixr 5 
Instances
Monad NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(>>=) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b #

(>>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #

return :: a -> NonEmpty a #

fail :: String -> NonEmpty a #

Functor NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

fmap :: (a -> b) -> NonEmpty a -> NonEmpty b #

(<$) :: a -> NonEmpty b -> NonEmpty a #

MonadFix NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Fix

Methods

mfix :: (a -> NonEmpty a) -> NonEmpty a #

Applicative NonEmpty

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

pure :: a -> NonEmpty a #

(<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b #

liftA2 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c #

(*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #

(<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a #

Foldable NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => NonEmpty m -> m #

foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m #

foldr :: (a -> b -> b) -> b -> NonEmpty a -> b #

foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b #

foldl :: (b -> a -> b) -> b -> NonEmpty a -> b #

foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b #

foldr1 :: (a -> a -> a) -> NonEmpty a -> a #

foldl1 :: (a -> a -> a) -> NonEmpty a -> a #

toList :: NonEmpty a -> [a] #

null :: NonEmpty a -> Bool #

length :: NonEmpty a -> Int #

elem :: Eq a => a -> NonEmpty a -> Bool #

maximum :: Ord a => NonEmpty a -> a #

minimum :: Ord a => NonEmpty a -> a #

sum :: Num a => NonEmpty a -> a #

product :: Num a => NonEmpty a -> a #

Traversable NonEmpty

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Methods

traverse :: Applicative f => (a -> f b) -> NonEmpty a -> f (NonEmpty b) #

sequenceA :: Applicative f => NonEmpty (f a) -> f (NonEmpty a) #

mapM :: Monad m => (a -> m b) -> NonEmpty a -> m (NonEmpty b) #

sequence :: Monad m => NonEmpty (m a) -> m (NonEmpty a) #

ToJSON1 NonEmpty 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON :: (a -> Value) -> ([a] -> Value) -> NonEmpty a -> Value #

liftToJSONList :: (a -> Value) -> ([a] -> Value) -> [NonEmpty a] -> Value #

liftToEncoding :: (a -> Encoding) -> ([a] -> Encoding) -> NonEmpty a -> Encoding #

liftToEncodingList :: (a -> Encoding) -> ([a] -> Encoding) -> [NonEmpty a] -> Encoding #

FromJSON1 NonEmpty 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (NonEmpty a) #

liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [NonEmpty a] #

Eq1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftEq :: (a -> b -> Bool) -> NonEmpty a -> NonEmpty b -> Bool #

Ord1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftCompare :: (a -> b -> Ordering) -> NonEmpty a -> NonEmpty b -> Ordering #

Read1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (NonEmpty a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [NonEmpty a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (NonEmpty a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [NonEmpty a] #

Show1 NonEmpty

Since: base-4.10.0.0

Instance details

Defined in Data.Functor.Classes

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NonEmpty a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [NonEmpty a] -> ShowS #

NFData1 NonEmpty

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> NonEmpty a -> () #

Cosieve Mealy NonEmpty 
Instance details

Defined in Data.Machine.Mealy

Methods

cosieve :: Mealy a b -> NonEmpty a -> b #

IsList (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Exts

Associated Types

type Item (NonEmpty a) :: Type #

Methods

fromList :: [Item (NonEmpty a)] -> NonEmpty a #

fromListN :: Int -> [Item (NonEmpty a)] -> NonEmpty a #

toList :: NonEmpty a -> [Item (NonEmpty a)] #

Eq a => Eq (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(==) :: NonEmpty a -> NonEmpty a -> Bool #

(/=) :: NonEmpty a -> NonEmpty a -> Bool #

Ord a => Ord (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

compare :: NonEmpty a -> NonEmpty a -> Ordering #

(<) :: NonEmpty a -> NonEmpty a -> Bool #

(<=) :: NonEmpty a -> NonEmpty a -> Bool #

(>) :: NonEmpty a -> NonEmpty a -> Bool #

(>=) :: NonEmpty a -> NonEmpty a -> Bool #

max :: NonEmpty a -> NonEmpty a -> NonEmpty a #

min :: NonEmpty a -> NonEmpty a -> NonEmpty a #

Read a => Read (NonEmpty a)

Since: base-4.11.0.0

Instance details

Defined in GHC.Read

Show a => Show (NonEmpty a)

Since: base-4.11.0.0

Instance details

Defined in GHC.Show

Methods

showsPrec :: Int -> NonEmpty a -> ShowS #

show :: NonEmpty a -> String #

showList :: [NonEmpty a] -> ShowS #

Generic (NonEmpty a) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (NonEmpty a) :: Type -> Type #

Methods

from :: NonEmpty a -> Rep (NonEmpty a) x #

to :: Rep (NonEmpty a) x -> NonEmpty a #

Semigroup (NonEmpty a)

Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

(<>) :: NonEmpty a -> NonEmpty a -> NonEmpty a #

sconcat :: NonEmpty (NonEmpty a) -> NonEmpty a #

stimes :: Integral b => b -> NonEmpty a -> NonEmpty a #

Hashable a => Hashable (NonEmpty a) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> NonEmpty a -> Int #

hash :: NonEmpty a -> Int #

ToJSON a => ToJSON (NonEmpty a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

FromJSON a => FromJSON (NonEmpty a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

NFData a => NFData (NonEmpty a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: NonEmpty a -> () #

SemiSequence (NonEmpty a) 
Instance details

Defined in Data.Sequences

Associated Types

type Index (NonEmpty a) :: Type #

MonoFunctor (NonEmpty a) 
Instance details

Defined in Data.MonoTraversable

Methods

omap :: (Element (NonEmpty a) -> Element (NonEmpty a)) -> NonEmpty a -> NonEmpty a #

MonoFoldable (NonEmpty a) 
Instance details

Defined in Data.MonoTraversable

Methods

ofoldMap :: Monoid m => (Element (NonEmpty a) -> m) -> NonEmpty a -> m #

ofoldr :: (Element (NonEmpty a) -> b -> b) -> b -> NonEmpty a -> b #

ofoldl' :: (a0 -> Element (NonEmpty a) -> a0) -> a0 -> NonEmpty a -> a0 #

otoList :: NonEmpty a -> [Element (NonEmpty a)] #

oall :: (Element (NonEmpty a) -> Bool) -> NonEmpty a -> Bool #

oany :: (Element (NonEmpty a) -> Bool) -> NonEmpty a -> Bool #

onull :: NonEmpty a -> Bool #

olength :: NonEmpty a -> Int #

olength64 :: NonEmpty a -> Int64 #

ocompareLength :: Integral i => NonEmpty a -> i -> Ordering #

otraverse_ :: Applicative f => (Element (NonEmpty a) -> f b) -> NonEmpty a -> f () #

ofor_ :: Applicative f => NonEmpty a -> (Element (NonEmpty a) -> f b) -> f () #

omapM_ :: Applicative m => (Element (NonEmpty a) -> m ()) -> NonEmpty a -> m () #

oforM_ :: Applicative m => NonEmpty a -> (Element (NonEmpty a) -> m ()) -> m () #

ofoldlM :: Monad m => (a0 -> Element (NonEmpty a) -> m a0) -> a0 -> NonEmpty a -> m a0 #

ofoldMap1Ex :: Semigroup m => (Element (NonEmpty a) -> m) -> NonEmpty a -> m #

ofoldr1Ex :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Element (NonEmpty a)) -> NonEmpty a -> Element (NonEmpty a) #

ofoldl1Ex' :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Element (NonEmpty a)) -> NonEmpty a -> Element (NonEmpty a) #

headEx :: NonEmpty a -> Element (NonEmpty a) #

lastEx :: NonEmpty a -> Element (NonEmpty a) #

unsafeHead :: NonEmpty a -> Element (NonEmpty a) #

unsafeLast :: NonEmpty a -> Element (NonEmpty a) #

maximumByEx :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Ordering) -> NonEmpty a -> Element (NonEmpty a) #

minimumByEx :: (Element (NonEmpty a) -> Element (NonEmpty a) -> Ordering) -> NonEmpty a -> Element (NonEmpty a) #

oelem :: Element (NonEmpty a) -> NonEmpty a -> Bool #

onotElem :: Element (NonEmpty a) -> NonEmpty a -> Bool #

MonoTraversable (NonEmpty a) 
Instance details

Defined in Data.MonoTraversable

Methods

otraverse :: Applicative f => (Element (NonEmpty a) -> f (Element (NonEmpty a))) -> NonEmpty a -> f (NonEmpty a) #

omapM :: Applicative m => (Element (NonEmpty a) -> m (Element (NonEmpty a))) -> NonEmpty a -> m (NonEmpty a) #

MonoPointed (NonEmpty a) 
Instance details

Defined in Data.MonoTraversable

Methods

opoint :: Element (NonEmpty a) -> NonEmpty a #

GrowingAppend (NonEmpty a) 
Instance details

Defined in Data.MonoTraversable

Generic1 NonEmpty 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 NonEmpty :: k -> Type #

Methods

from1 :: NonEmpty a -> Rep1 NonEmpty a #

to1 :: Rep1 NonEmpty a -> NonEmpty a #

MonadReader (NonEmpty a) (Mealy a) 
Instance details

Defined in Data.Machine.Mealy

Methods

ask :: Mealy a (NonEmpty a) #

local :: (NonEmpty a -> NonEmpty a) -> Mealy a a0 -> Mealy a a0 #

reader :: (NonEmpty a -> a0) -> Mealy a a0 #

type Rep (NonEmpty a)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Item (NonEmpty a) 
Instance details

Defined in GHC.Exts

type Item (NonEmpty a) = a
type Index (NonEmpty a) 
Instance details

Defined in Data.Sequences

type Index (NonEmpty a) = Int
type Element (NonEmpty a) 
Instance details

Defined in Data.MonoTraversable

type Element (NonEmpty a) = a
type Rep1 NonEmpty

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

nonEmpty :: [a] -> Maybe (NonEmpty a) #

nonEmpty efficiently turns a normal list into a NonEmpty stream, producing Nothing if the input is empty.

data TLSSettings #

TLS Settings that can be either expressed as simple settings, or as full blown TLS.Params settings.

Unless you need access to parameters that are not accessible through the simple settings, you should use TLSSettingsSimple.

Instances
Show TLSSettings 
Instance details

Defined in Network.Connection.Types

Default TLSSettings 
Instance details

Defined in Network.Connection.Types

Methods

def :: TLSSettings #

data NominalDiffTime #

This is a length of time, as measured by UTC. Conversion functions will treat it as seconds. It has a precision of 10^-12 s. It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), regardless of whether a leap-second intervened.

Instances
Enum NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Eq NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Fractional NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Data NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> NominalDiffTime -> c NominalDiffTime #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c NominalDiffTime #

toConstr :: NominalDiffTime -> Constr #

dataTypeOf :: NominalDiffTime -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c NominalDiffTime) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NominalDiffTime) #

gmapT :: (forall b. Data b => b -> b) -> NominalDiffTime -> NominalDiffTime #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> NominalDiffTime -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> NominalDiffTime -> r #

gmapQ :: (forall d. Data d => d -> u) -> NominalDiffTime -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> NominalDiffTime -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> NominalDiffTime -> m NominalDiffTime #

Num NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Ord NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Real NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

RealFrac NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Show NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

ToJSON NominalDiffTime 
Instance details

Defined in Data.Aeson.Types.ToJSON

FromJSON NominalDiffTime

This instance includes a bounds check to prevent maliciously large inputs to fill up the memory of the target system. You can newtype Scientific and provide your own instance using withScientific if you want to allow larger inputs.

Instance details

Defined in Data.Aeson.Types.FromJSON

NFData NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Methods

rnf :: NominalDiffTime -> () #