Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)
Safe HaskellSafe-Inferred

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

class Serialize a where Source #

Methods

put :: Putter a Source #

get :: Get a Source #

Instances

Instances details
Serialize Int.Int64 Source # 
Instance details

Defined in Util.Serialize

Serialize Word.Word32 Source # 
Instance details

Defined in Util.Serialize

Serialize Word.Word64 Source # 
Instance details

Defined in Util.Serialize

Serialize Word.Word8 Source # 
Instance details

Defined in Util.Serialize

Serialize ByteString.ByteString Source # 
Instance details

Defined in Util.Serialize

Serialize CmdResult Source # 
Instance details

Defined in App.ReplProtocol

Serialize Editor Source # 
Instance details

Defined in App.ReplProtocol

Serialize File Source # 
Instance details

Defined in App.ReplProtocol

Serialize FileType Source # 
Instance details

Defined in App.ReplProtocol

Serialize NotifySeq Source # 
Instance details

Defined in App.ReplProtocol

Serialize Query Source # 
Instance details

Defined in App.ReplProtocol

Serialize Response Source # 
Instance details

Defined in App.ReplProtocol

Serialize Result Source # 
Instance details

Defined in App.ReplProtocol

Serialize Attributes Source # 
Instance details

Defined in Derive.Attrs

Serialize MiniVal Source # 
Instance details

Defined in Derive.Expr

Serialize Str Source # 
Instance details

Defined in Derive.Expr

Serialize Symbol Source # 
Instance details

Defined in Derive.Expr

Serialize Environ Source # 
Instance details

Defined in Derive.REnv

Serialize Val Source # 
Instance details

Defined in Derive.REnv

Serialize Control Source # 
Instance details

Defined in Derive.ScoreT

Serialize Instrument Source # 
Instance details

Defined in Derive.ScoreT

Serialize PControl Source # 
Instance details

Defined in Derive.ScoreT

Serialize Type Source # 
Instance details

Defined in Derive.ScoreT

Serialize Frame Source # 
Instance details

Defined in Derive.Stack

Serialize Stack Source # 
Instance details

Defined in Derive.Stack

Serialize Config Source # 
Instance details

Defined in Cmd.Serialize

Serialize Flag Source # 
Instance details

Defined in Cmd.Serialize

Serialize Qualified Source # 
Instance details

Defined in Instrument.InstT

Serialize Index Source # 
Instance details

Defined in Instrument.Serialize

Serialize InstrumentDb Source # 
Instance details

Defined in Instrument.Serialize

Serialize Key Source # 
Instance details

Defined in Midi.Midi

Serialize Message Source # 
Instance details

Defined in Midi.Instances

Serialize ReadDevice Source # 
Instance details

Defined in Midi.Midi

Serialize ReadMessage Source # 
Instance details

Defined in Midi.Instances

Serialize WriteDevice Source # 
Instance details

Defined in Midi.Midi

Serialize WriteMessage Source # 
Instance details

Defined in Midi.Instances

Serialize Config Source # 
Instance details

Defined in Cmd.Serialize

Serialize Duration Source # 
Instance details

Defined in Cmd.Serialize

Serialize StaffConfig Source # 
Instance details

Defined in Cmd.Serialize

Serialize Config Source # 
Instance details

Defined in Cmd.Serialize

Serialize Flag Source # 
Instance details

Defined in Cmd.Serialize

Serialize Initialization Source # 
Instance details

Defined in Cmd.Serialize

Serialize InitializePatch Source # 
Instance details

Defined in Instrument.Serialize

Serialize Keymap Source # 
Instance details

Defined in Instrument.Serialize

Serialize Keyswitch Source # 
Instance details

Defined in Instrument.Serialize

Serialize ModeMap Source # 
Instance details

Defined in Instrument.Serialize

Serialize Patch Source # 
Instance details

Defined in Instrument.Serialize

Serialize Scale Source # 
Instance details

Defined in Cmd.Serialize

Serialize Settings Source # 
Instance details

Defined in Cmd.Serialize

Serialize Degree Source # 
Instance details

Defined in Perform.Pitch

Serialize Key Source # 
Instance details

Defined in Perform.Pitch

Serialize Note Source # 
Instance details

Defined in Perform.Pitch

Serialize NoteNumber Source # 
Instance details

Defined in Perform.Pitch

Serialize Pitch Source # 
Instance details

Defined in Perform.Pitch

Serialize ScaleId Source # 
Instance details

Defined in Perform.Pitch

Serialize RealTime Source # 
Instance details

Defined in Perform.RealTime

Serialize State Source # 
Instance details

Defined in Synth.Faust.EffectC

Serialize PlayState Source # 
Instance details

Defined in Synth.Sampler.Render

Serialize ResampleState Source # 
Instance details

Defined in Synth.Sampler.Render

Serialize State Source # 
Instance details

Defined in Synth.Sampler.Render

Serialize Sample Source # 
Instance details

Defined in Synth.Sampler.Sample

Serialize Stretch Source # 
Instance details

Defined in Synth.Sampler.Sample

Serialize StretchMode Source # 
Instance details

Defined in Synth.Sampler.Sample

Serialize Control Source # 
Instance details

Defined in Synth.Shared.Control

Serialize Hash Source # 
Instance details

Defined in Synth.Shared.Note

Serialize Note Source # 
Instance details

Defined in Synth.Shared.Note

Serialize Block Source # 
Instance details

Defined in Cmd.Serialize

Serialize Divider Source # 
Instance details

Defined in Cmd.Serialize

Serialize NoteDestination Source # 
Instance details

Defined in Cmd.Serialize

Serialize Padding Source # 
Instance details

Defined in Cmd.Serialize

Serialize Skeleton Source # 
Instance details

Defined in Cmd.Serialize

Serialize Track Source # 
Instance details

Defined in Cmd.Serialize

Serialize TrackDestinations Source # 
Instance details

Defined in Cmd.Serialize

Serialize TrackFlag Source # 
Instance details

Defined in Cmd.Serialize

Serialize TracklikeId Source # 
Instance details

Defined in Cmd.Serialize

Serialize View Source # 
Instance details

Defined in Cmd.Serialize

Serialize Color Source # 
Instance details

Defined in Cmd.Serialize

Serialize Event Source # 
Instance details

Defined in Ui.Event

Serialize Stack Source # 
Instance details

Defined in Ui.Event

Serialize Events Source # 
Instance details

Defined in Ui.Events

Serialize BlockId Source # 
Instance details

Defined in Ui.Id

Serialize Id Source # 
Instance details

Defined in Ui.Id

Serialize Namespace Source # 
Instance details

Defined in Ui.Id

Serialize RulerId Source # 
Instance details

Defined in Ui.Id

Serialize TrackId Source # 
Instance details

Defined in Ui.Id

Serialize ViewId Source # 
Instance details

Defined in Ui.Id

Serialize Mark Source # 
Instance details

Defined in Cmd.Serialize

Serialize Marklist Source # 
Instance details

Defined in Cmd.Serialize

Serialize AbstractMeter Source # 
Instance details

Defined in Cmd.Serialize

Serialize Config Source # 
Instance details

Defined in Cmd.Serialize

Serialize LabelConfig Source # 
Instance details

Defined in Cmd.Serialize

Serialize MSection Source # 
Instance details

Defined in Cmd.Serialize

Serialize Meter Source # 
Instance details

Defined in Cmd.Serialize

Serialize Rank Source # 
Instance details

Defined in Cmd.Serialize

Serialize Ruler Source # 
Instance details

Defined in Cmd.Serialize

Serialize ScoreTime Source # 
Instance details

Defined in Ui.ScoreTime

Serialize Orientation Source # 
Instance details

Defined in Cmd.Serialize

Serialize Selection Source # 
Instance details

Defined in Cmd.Serialize

Serialize Skeleton Source # 
Instance details

Defined in Ui.Skeleton

Serialize StyleId Source # 
Instance details

Defined in Ui.Style

Serialize RenderConfig Source # 
Instance details

Defined in Cmd.Serialize

Serialize RenderSource Source # 
Instance details

Defined in Cmd.Serialize

Serialize RenderStyle Source # 
Instance details

Defined in Cmd.Serialize

Serialize Track Source # 
Instance details

Defined in Cmd.Serialize

Serialize Orientation Source # 
Instance details

Defined in Ui.Types

Serialize State Source # 
Instance details

Defined in Cmd.Serialize

Serialize Allocation Source # 
Instance details

Defined in Cmd.Serialize

Serialize Allocations Source # 
Instance details

Defined in Cmd.Serialize

Serialize Backend Source # 
Instance details

Defined in Cmd.Serialize

Serialize Config Source # 
Instance details

Defined in Cmd.Serialize

Serialize Default Source # 
Instance details

Defined in Cmd.Serialize

Serialize Meta Source # 
Instance details

Defined in Cmd.Serialize

Serialize Zoom Source # 
Instance details

Defined in Cmd.Serialize

Serialize Frames Source # 
Instance details

Defined in Util.Audio.AudioT

Serialize SavedState Source # 
Instance details

Defined in Util.Audio.Resample

Serialize CallStack.Caller Source # 
Instance details

Defined in Util.Serialize

Serialize Doc Source # 
Instance details

Defined in Util.Doc

Serialize Msg Source # 
Instance details

Defined in Util.Log

Serialize Priority Source # 
Instance details

Defined in Util.Log

Serialize Rect Source # 
Instance details

Defined in Cmd.Serialize

Serialize Text Source # 
Instance details

Defined in Util.Serialize

Serialize UTCTime Source # 
Instance details

Defined in Util.Serialize

Serialize Integer Source # 
Instance details

Defined in Util.Serialize

Serialize () Source # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter () Source #

get :: Get () Source #

Serialize Bool Source # 
Instance details

Defined in Util.Serialize

Serialize Char Source # 
Instance details

Defined in Util.Serialize

Serialize Double Source # 
Instance details

Defined in Util.Serialize

Serialize Float Source # 
Instance details

Defined in Util.Serialize

Serialize Int.Int Source # 
Instance details

Defined in Util.Serialize

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

Defined in Util.Serialize

Methods

put :: Putter (Set a) Source #

get :: Get (Set a) Source #

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

Defined in Derive.ScoreT

Methods

put :: Putter (Typed a) Source #

get :: Get (Typed a) Source #

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

Defined in Instrument.Common

Serialize (Common ()) Source # 
Instance details

Defined in Instrument.Serialize

Methods

put :: Putter (Common ()) Source #

get :: Get (Common ()) Source #

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

Defined in Cmd.Serialize

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

Defined in Util.Segment

Methods

put :: Putter (Signal v) Source #

get :: Get (Signal v) Source #

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

Defined in Util.TimeVectorStorable

Methods

put :: Putter (Sample y) Source #

get :: Get (Sample y) Source #

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

Defined in Util.Serialize

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

Defined in Util.Serialize

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

Defined in Util.Serialize

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

Defined in Util.Serialize

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

Defined in Util.Serialize

Methods

put :: Putter (Maybe a) Source #

get :: Get (Maybe a) Source #

Serialize a => Serialize [a] Source # 
Instance details

Defined in Util.Serialize

Methods

put :: Putter [a] Source #

get :: Get [a] Source #

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

Defined in Util.Serialize

Methods

put :: Putter (Either a b) Source #

get :: Get (Either a b) Source #

(Serialize i, Ix i, Serialize e) => Serialize (Array i e) Source # 
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) Source # 
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) Source # 
Instance details

Defined in Derive.DeriveT

Methods

put :: Putter (Ref control val) Source #

get :: Get (Ref control val) Source #

Serialize (Signal kind) Source # 
Instance details

Defined in Perform.Signal

Methods

put :: Putter (Signal kind) Source #

get :: Get (Signal kind) Source #

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

Defined in Util.Serialize

Methods

put :: Putter (a, b) Source #

get :: Get (a, b) Source #

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

Defined in Util.Serialize

Methods

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

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

data Get a #

The Get monad is an Exception and State monad.

Instances

Instances details
MonadFail Get 
Instance details

Defined in Data.Serialize.Get

Methods

fail :: String -> 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] #

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 #

Functor Get 
Instance details

Defined in Data.Serialize.Get

Methods

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

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

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 #

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 ().

magic

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

Instances details
Show (Magic a) Source # 
Instance details

Defined in Util.Serialize

Methods

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

show :: Magic a -> String #

showList :: [Magic a] -> ShowS #

serialize Source #

Arguments

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

result of File.writeGz.

util

put_enum :: Word.Word8 -> Put Source #

It's just put, but make sure it's using Int. Word8 would be more suitable.

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

These are convenient but dangerous. If they are are used in a context where backward compatibility matters (Cmd.Serialize) then it's too easy to break compatibility by adding or removing an enum.

But they're fine if used in an enum that will never change, or where compatibility doesn't matter.

versions