protocol-buffers-2.0.9: Parse Google Protocol Buffer specifications

Safe HaskellNone



This provides what is needed for the output of hprotoc to compile. This and the Prelude will both be imported qualified as P', the prime ensuring no name conflicts are possible.



append :: Seq a -> a -> Seq aSource

pack :: [Char] -> ByteString

O(n) Convert a String into a ByteString.

fromMaybe :: a -> Maybe a -> a

The fromMaybe function takes a default value and and Maybe value. If the Maybe is Nothing, it returns the default values; otherwise, it returns the value contained in the Maybe.

ap :: Monad m => m (a -> b) -> m a -> m b

In many situations, the liftM operations can be replaced by uses of ap, which promotes function application.

       return f `ap` x1 `ap` ... `ap` xn

is equivalent to

       liftMn f x1 x2 ... xn

fromDistinctAscList :: [a] -> Set a

O(n). Build a set from an ascending list of distinct elements in linear time. The precondition (input list is strictly ascending) is not checked.

member :: Ord a => a -> Set a -> Bool

O(log n). Is the element in the set?

throwError :: MonadError e m => forall a. e -> m a

Is used within a monadic computation to begin exception processing.

catchError :: MonadError e m => forall a. m a -> (e -> m a) -> m a

A handler function to handle previous errors and return to normal execution. A common idiom is:

 do { action1; action2; action3 } `catchError` handler

where the action functions can call throwError. Note that handler and the do-block must have the same return type.