Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Util.Serialize

Description

This module implements a Serialize class and serializers for basic types.

It duplicates a lot from the standard Serialize class, but this one at least is under my control. The other one is not guaranteed to remain compatible. Of course, it's unlikely to change incompatibly and I use it myself rather than re-implementing String and Integer encoding, but that's the theory anyway.

At the least it lets me use a direct float encoding rather than hacking around the large and buggy default implementation.

Synopsis

Documentation

data Magic a Source #

This is a four byte prefix to identify a particular file type, tagged with the serialized type. The Chars are just for syntactic convenience only, and must be ASCII.

The constructor is not exported, so all magics have to be defined here, which should make it easy to avoid collisions.

Constructors

Magic !Char !Char !Char !Char 
Instances
Show (Magic a) # 
Instance details

Defined in Util.Serialize

Methods

showsPrec :: Int.Int -> Magic a -> ShowS #

show :: Magic a -> String #

showList :: [Magic a] -> ShowS #

class Serialize a where Source #

Minimal complete definition

put, get

Methods

put :: Putter a Source #

get :: Get a Source #

Instances
Serialize Bool # 
Instance details

Defined in Util.Serialize

Serialize Char # 
Instance details

Defined in Util.Serialize

Serialize Double # 
Instance details

Defined in Util.Serialize

Serialize Float # 
Instance details

Defined in Util.Serialize

Serialize Int.Int # 
Instance details

Defined in Util.Serialize

Serialize Int.Int64 # 
Instance details

Defined in Util.Serialize

Serialize Integer # 
Instance details

Defined in Util.Serialize

Serialize Word.Word8 # 
Instance details

Defined in Util.Serialize

Serialize Word.Word32 # 
Instance details

Defined in Util.Serialize

Serialize Word.Word64 # 
Instance details

Defined in Util.Serialize

Serialize () # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter () Source #

get :: Get () Source #

Serialize ByteString.ByteString # 
Instance details

Defined in Util.Serialize

Serialize UTCTime # 
Instance details

Defined in Util.Serialize

Serialize Text # 
Instance details

Defined in Util.Serialize

Serialize CallStack.Caller # 
Instance details

Defined in Util.Serialize

Serialize Rect # 
Instance details

Defined in Cmd.Serialize

Serialize Orientation # 
Instance details

Defined in Ui.Types

Serialize RulerId # 
Instance details

Defined in Ui.Id

Serialize TrackId # 
Instance details

Defined in Ui.Id

Serialize ViewId # 
Instance details

Defined in Ui.Id

Serialize BlockId # 
Instance details

Defined in Ui.Id

Serialize Namespace # 
Instance details

Defined in Ui.Id

Serialize Id # 
Instance details

Defined in Ui.Id

Serialize Color # 
Instance details

Defined in Cmd.Serialize

Serialize StyleId # 
Instance details

Defined in Ui.Style

Serialize Control # 
Instance details

Defined in Synth.Shared.Control

Serialize Qualified # 
Instance details

Defined in Instrument.InstTypes

Serialize Doc # 
Instance details

Defined in Util.Doc

Serialize ScoreTime # 
Instance details

Defined in Ui.ScoreTime

Serialize Zoom # 
Instance details

Defined in Cmd.Serialize

Serialize RealTime # 
Instance details

Defined in Perform.RealTime

Serialize Orientation # 
Instance details

Defined in Cmd.Serialize

Serialize Selection # 
Instance details

Defined in Cmd.Serialize

Serialize Attributes # 
Instance details

Defined in Derive.Attrs

Serialize Skeleton # 
Instance details

Defined in Ui.Skeleton

Serialize Key # 
Instance details

Defined in Midi.Midi

Serialize Message # 
Instance details

Defined in Midi.Instances

Serialize WriteDevice # 
Instance details

Defined in Midi.Midi

Serialize ReadDevice # 
Instance details

Defined in Midi.Midi

Serialize ReadMessage # 
Instance details

Defined in Midi.Instances

Serialize WriteMessage # 
Instance details

Defined in Midi.Instances

Serialize Key # 
Instance details

Defined in Perform.Pitch

Serialize ScaleId # 
Instance details

Defined in Perform.Pitch

Serialize NoteNumber # 
Instance details

Defined in Perform.Pitch

Serialize Degree # 
Instance details

Defined in Perform.Pitch

Serialize Pitch # 
Instance details

Defined in Perform.Pitch

Serialize Note # 
Instance details

Defined in Perform.Pitch

Serialize Frame # 
Instance details

Defined in Derive.Stack

Serialize Stack # 
Instance details

Defined in Derive.Stack

Serialize Priority # 
Instance details

Defined in Util.Log

Serialize Msg # 
Instance details

Defined in Util.Log

Serialize File # 
Instance details

Defined in App.ReplProtocol

Serialize Editor # 
Instance details

Defined in App.ReplProtocol

Serialize Result # 
Instance details

Defined in App.ReplProtocol

Serialize CmdResult # 
Instance details

Defined in App.ReplProtocol

Serialize Response # 
Instance details

Defined in App.ReplProtocol

Serialize Query # 
Instance details

Defined in App.ReplProtocol

Serialize Stack # 
Instance details

Defined in Ui.Event

Serialize Event # 
Instance details

Defined in Ui.Event

Serialize Events # 
Instance details

Defined in Ui.Events

Serialize Mark # 
Instance details

Defined in Cmd.Serialize

Serialize Marklist # 
Instance details

Defined in Cmd.Serialize

Serialize MeterConfig # 
Instance details

Defined in Cmd.Serialize

Serialize Ruler # 
Instance details

Defined in Cmd.Serialize

Serialize Hash # 
Instance details

Defined in Synth.Shared.Note

Serialize Note # 
Instance details

Defined in Synth.Shared.Note

Serialize Type # 
Instance details

Defined in Derive.ScoreTypes

Serialize PControl # 
Instance details

Defined in Derive.ScoreTypes

Serialize Control # 
Instance details

Defined in Derive.ScoreTypes

Serialize Instrument # 
Instance details

Defined in Derive.ScoreTypes

Serialize Str # 
Instance details

Defined in Derive.Expr

Serialize Symbol # 
Instance details

Defined in Derive.Expr

Serialize Duration # 
Instance details

Defined in Cmd.Serialize

Serialize StaffConfig # 
Instance details

Defined in Cmd.Serialize

Serialize Config # 
Instance details

Defined in Cmd.Serialize

Serialize RenderSource # 
Instance details

Defined in Cmd.Serialize

Serialize RenderStyle # 
Instance details

Defined in Cmd.Serialize

Serialize RenderConfig # 
Instance details

Defined in Cmd.Serialize

Serialize Track # 
Instance details

Defined in Cmd.Serialize

Serialize Padding # 
Instance details

Defined in Cmd.Serialize

Serialize View # 
Instance details

Defined in Cmd.Serialize

Serialize Divider # 
Instance details

Defined in Cmd.Serialize

Serialize TracklikeId # 
Instance details

Defined in Cmd.Serialize

Serialize TrackFlag # 
Instance details

Defined in Cmd.Serialize

Serialize Track # 
Instance details

Defined in Cmd.Serialize

Serialize NoteDestination # 
Instance details

Defined in Cmd.Serialize

Serialize TrackDestinations # 
Instance details

Defined in Cmd.Serialize

Serialize Block # 
Instance details

Defined in Cmd.Serialize

Serialize Term # 
Instance details

Defined in Derive.RestrictedEnviron

Serialize Call # 
Instance details

Defined in Derive.RestrictedEnviron

Serialize Val # 
Instance details

Defined in Derive.RestrictedEnviron

Serialize Environ # 
Instance details

Defined in Derive.RestrictedEnviron

Serialize Config # 
Instance details

Defined in Cmd.Serialize

Serialize Keyswitch # 
Instance details

Defined in Instrument.Serialize

Serialize Keymap # 
Instance details

Defined in Instrument.Serialize

Serialize InitializePatch # 
Instance details

Defined in Instrument.Serialize

Serialize Flag # 
Instance details

Defined in Perform.Midi.Patch

Serialize Scale # 
Instance details

Defined in Cmd.Serialize

Serialize Patch # 
Instance details

Defined in Instrument.Serialize

Serialize Settings # 
Instance details

Defined in Cmd.Serialize

Serialize Initialization # 
Instance details

Defined in Cmd.Serialize

Serialize Config # 
Instance details

Defined in Cmd.Serialize

Serialize Default # 
Instance details

Defined in Cmd.Serialize

Serialize Meta # 
Instance details

Defined in Cmd.Serialize

Serialize Backend # 
Instance details

Defined in Cmd.Serialize

Serialize Allocation # 
Instance details

Defined in Cmd.Serialize

Serialize Allocations # 
Instance details

Defined in Cmd.Serialize

Serialize Config # 
Instance details

Defined in Cmd.Serialize

Serialize State # 
Instance details

Defined in Cmd.Serialize

Serialize Index # 
Instance details

Defined in Instrument.Serialize

Serialize InstrumentDb # 
Instance details

Defined in Instrument.Serialize

Serialize a => Serialize [a] # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter [a] Source #

get :: Get [a] Source #

Serialize a => Serialize (Maybe a) # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter (Maybe a) Source #

get :: Get (Maybe a) Source #

Serialize a => Serialize (NonEmpty a) # 
Instance details

Defined in Util.Serialize

(Ord a, Serialize a) => Serialize (Set a) # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter (Set a) Source #

get :: Get (Set a) Source #

(Serialize a, Unboxed.Unbox a) => Serialize (Unboxed.Vector a) # 
Instance details

Defined in Util.Serialize

(Serialize a, Storable a) => Serialize (Vector.Storable.Vector a) # 
Instance details

Defined in Util.Serialize

Serialize a => Serialize (Vector.Vector a) # 
Instance details

Defined in Util.Serialize

Serialize y => Serialize (Sample y) # 
Instance details

Defined in Util.TimeVectorStorable

Methods

put :: Putter (Sample y) Source #

get :: Get (Sample y) Source #

Serialize v => Serialize (Signal v) # 
Instance details

Defined in Util.Segment

Methods

put :: Putter (Signal v) Source #

get :: Get (Signal v) Source #

Serialize (Signal kind) # 
Instance details

Defined in Perform.Signal

Methods

put :: Putter (Signal kind) Source #

get :: Get (Signal kind) Source #

Serialize a => Serialize (Typed a) # 
Instance details

Defined in Derive.ScoreTypes

Methods

put :: Putter (Typed a) Source #

get :: Get (Typed a) Source #

Serialize a => Serialize (AttributeMap a) # 
Instance details

Defined in Instrument.Common

Serialize (Common ()) # 
Instance details

Defined in Instrument.Serialize

Methods

put :: Putter (Common ()) Source #

get :: Get (Common ()) Source #

Serialize a => Serialize (Performance a) # 
Instance details

Defined in Cmd.Serialize

(Serialize a, Serialize b) => Serialize (a, b) # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter (a, b) Source #

get :: Get (a, b) Source #

(Serialize i, Ix i, Serialize e) => Serialize (Array i e) # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter (Array i e) Source #

get :: Get (Array i e) Source #

(Ord k, Serialize k, Serialize v) => Serialize (Map k v) # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter (Map k v) Source #

get :: Get (Map k v) Source #

(Serialize val, Serialize control) => Serialize (Ref control val) # 
Instance details

Defined in Derive.BaseTypes

Methods

put :: Putter (Ref control val) Source #

get :: Get (Ref control val) Source #

(Serialize a, Serialize b, Serialize c) => Serialize (a, b, c) # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter (a, b, c) Source #

get :: Get (a, b, c) Source #

serialize Source #

Arguments

:: Serialize a 
=> Magic a 
-> FilePath 
-> a 
-> IO Bool

result of File.writeGz.

_encodef :: (Storable float, Storable word) => float -> word Source #

_decodef :: (Storable float, Storable word) => word -> float Source #

put_enum :: Enum a => a -> Put Source #

get_enum :: (Bounded a, Enum a) => Get a Source #

to_enum :: forall a. (Enum a, Bounded a) => Int.Int -> Maybe a Source #

A safe version of toEnum.

data Get a #

The Get monad is an Exception and State monad.

Instances
Monad Get 
Instance details

Defined in Data.Serialize.Get

Methods

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

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

return :: a -> Get a #

fail :: String -> Get a #

Functor Get 
Instance details

Defined in Data.Serialize.Get

Methods

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

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

MonadFail Get 
Instance details

Defined in Data.Serialize.Get

Methods

fail :: String -> Get a #

Applicative Get 
Instance details

Defined in Data.Serialize.Get

Methods

pure :: a -> Get a #

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

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

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

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

Alternative Get 
Instance details

Defined in Data.Serialize.Get

Methods

empty :: Get a #

(<|>) :: Get a -> Get a -> Get a #

some :: Get a -> Get [a] #

many :: Get a -> Get [a] #

MonadPlus Get 
Instance details

Defined in Data.Serialize.Get

Methods

mzero :: Get a #

mplus :: Get a -> Get a -> Get a #

type Put = PutM () #

Put merely lifts Builder into a Writer monad, applied to ().

getWord8 :: Get Word.Word8 #

Read a Word8 from the monad state

putWord8 :: Putter Word.Word8 #

Efficiently write a byte into the output buffer