A door's settings program.
Modulevortex-ws-0.2.1GHC2024
Vortex.Ws.Door.Settings
The scope a door's settings program is elaborated in. Its export list
is the whole of what such a program may name: the program's type and
the verbs. Only origin is required, and it may be repeated; every
other verb has a default and may be given at most once.
do
origin "https://vortex.openfp.net"
frameBytes 8192
sessions 64 4
peerRate 20 2- 4 types
- 7 values
- Packagevortex-ws-0.2.1
- Exports11
- LanguageGHC2024
- LicenceBSD-3-Clause
- SourceSettings.hs
The program type
4 declarationsString is an alias for a list of characters.
String constants in Haskell are values of type String.
That means if you write a string literal like "hello world",
it will have the type [Char], which is the same as String.
Note: You can ask the compiler to automatically infer different types
with the -XOverloadedStrings language extension, for example
"hello world" :: Text. See IsString for more information.
Because String is just a list of characters, you can use normal list functions
to do basic string manipulation. See Data.List for operations on lists.
Performance considerations
[Char] is a relatively memory-inefficient type.
It is a linked list of boxed word-size characters, internally it looks something like:
╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭────╮
│ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ [] │
╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰────╯
v v v
'a' 'b' 'c'The String "abc" will use 5*3+1 = 16 (in general 5n+1)
words of space in memory.
Furthermore, operations like (++) (string concatenation) are O(n)
(in the left argument).
For historical reasons, the base library uses String in a lot of places
for the conceptual simplicity, but library code dealing with user-data
should use the text
package for Unicode text, or the the
bytestring package
for binary data.
A fixed-precision integer type with at least the range [-2^29 .. 2^29-1].
The exact range for a given implementation can be determined by using
Prelude.minBound and Prelude.maxBound from the Prelude.Bounded class.
Instances104Bounded, Enum, Integral, Data, Num, Read, …
Bounded IntDefined in ghc-internal-9.1401.0 · GHC.Internal.EnumEnum IntDefined in ghc-internal-9.1401.0 · GHC.Internal.EnumEq IntDefined in ghc-internal-9.1401.0 · GHC.Internal.ClassesIntegral IntDefined in ghc-internal-9.1401.0 · GHC.Internal.RealData IntDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.DataNum IntDefined in ghc-internal-9.1401.0 · GHC.Internal.NumOrd IntDefined in ghc-internal-9.1401.0 · GHC.Internal.ClassesRead IntDefined in ghc-internal-9.1401.0 · GHC.Internal.ReadReal IntDefined in ghc-internal-9.1401.0 · GHC.Internal.RealShow IntDefined in ghc-internal-9.1401.0 · GHC.Internal.ShowIx IntDefined in ghc-internal-9.1401.0 · GHC.Internal.IxBits IntDefined in ghc-internal-9.1401.0 · GHC.Internal.BitsFiniteBits IntDefined in ghc-internal-9.1401.0 · GHC.Internal.BitsStorable IntDefined in ghc-internal-9.1401.0 · GHC.Internal.Foreign.StorablePrintfArg IntDefined in base-4.22.0.0 · Text.PrintfNFData IntDefined in deepseq-1.5.1.0 · Control.DeepSeqPretty IntDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJClassPretty IntDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassRandom IntDefined in random-1.3.1 · System.RandomFinite IntDefined in random-1.3.1 · System.Random.GFiniteUniform IntDefined in random-1.3.1 · System.Random.InternalUniformRange IntDefined in random-1.3.1 · System.Random.InternalArbitrary IntDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.ArbitraryCoArbitrary IntDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.ArbitraryFunction IntDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.FunctionBinary IntDefined in binary-0.8.9.3 · Data.Binary.ClassHashable IntDefined in hashable-1.5.1.0 · Data.Hashable.ClassPrim IntDefined in primitive-0.9.1.0 · Data.Primitive.TypesUnbox IntDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseShowPadded IntDefined in time-1.15 · Data.Time.Calendar.PrivateShowPadded IntDefined in time-compat-1.9.9 · Data.Time.Calendar.PrivateByteSource IntDefined in uuid-types-1.0.6.1 · Data.UUID.Types.Internal.BuilderFromJSON IntDefined in aeson-2.3.2.0 · Data.Aeson.Types.FromJSONFromJSONKey IntDefined in aeson-2.3.2.0 · Data.Aeson.Types.FromJSONToJSON IntDefined in aeson-2.3.2.0 · Data.Aeson.Types.ToJSONToJSONKey IntDefined in aeson-2.3.2.0 · Data.Aeson.Types.ToJSONUnagiPrim IntDefined in unagi-chan-0.4.1.4 · Control.Concurrent.Chan.Unagi.Unboxed.InternalLift IntDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.LiftIArray UArray IntDefined in array-0.5.8.0 · Data.Array.BaseFoldableWithIndex Int IntMapDefined in indexed-traversable-0.1.5 · WithIndexFoldableWithIndex Int SeqDefined in indexed-traversable-0.1.5 · WithIndexFoldableWithIndex Int NonEmptyDefined in indexed-traversable-0.1.5 · WithIndexFoldableWithIndex Int ZipListDefined in indexed-traversable-0.1.5 · WithIndexFoldableWithIndex Int VectorDefined in indexed-traversable-instances-0.1.2.1 · Data.Functor.WithIndex.Instances · orphanFoldableWithIndex Int []Defined in indexed-traversable-0.1.5 · WithIndexFoldable1WithIndex Int NonEmptyDefined in indexed-traversable-0.1.5 · WithIndexFunctorWithIndex Int IntMapDefined in indexed-traversable-0.1.5 · WithIndexFunctorWithIndex Int SeqDefined in indexed-traversable-0.1.5 · WithIndexThe position in the Seq is available as the index.
FunctorWithIndex Int NonEmptyDefined in indexed-traversable-0.1.5 · WithIndexFunctorWithIndex Int ZipListDefined in indexed-traversable-0.1.5 · WithIndexSame instance as for
[].FunctorWithIndex Int VectorDefined in indexed-traversable-instances-0.1.2.1 · Data.Functor.WithIndex.Instances · orphanFunctorWithIndex Int []Defined in indexed-traversable-0.1.5 · WithIndexThe position in the list is available as the index.
TraversableWithIndex Int IntMapDefined in indexed-traversable-0.1.5 · WithIndexTraversableWithIndex Int SeqDefined in indexed-traversable-0.1.5 · WithIndexTraversableWithIndex Int NonEmptyDefined in indexed-traversable-0.1.5 · WithIndexTraversableWithIndex Int ZipListDefined in indexed-traversable-0.1.5 · WithIndexTraversableWithIndex Int VectorDefined in indexed-traversable-instances-0.1.2.1 · Data.Functor.WithIndex.Instances · orphanTraversableWithIndex Int []Defined in indexed-traversable-0.1.5 · WithIndexMVector MVector IntDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseVector Vector IntDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseRepeatWithIndex Int NonEmptyDefined in semialign-1.4 · Data.Semialign.InternalRepeatWithIndex Int ZipListDefined in semialign-1.4 · Data.Semialign.InternalRepeatWithIndex Int []Defined in semialign-1.4 · Data.Semialign.InternalSemialignWithIndex Int IntMapDefined in semialign-1.4 · Data.Semialign.InternalSemialignWithIndex Int SeqDefined in semialign-1.4 · Data.Semialign.InternalSemialignWithIndex Int NonEmptyDefined in semialign-1.4 · Data.Semialign.InternalSemialignWithIndex Int ZipListDefined in semialign-1.4 · Data.Semialign.InternalSemialignWithIndex Int VectorDefined in semialign-1.4 · Data.Semialign.InternalSemialignWithIndex Int []Defined in semialign-1.4 · Data.Semialign.InternalZipWithIndex Int IntMapDefined in semialign-1.4 · Data.Semialign.InternalZipWithIndex Int SeqDefined in semialign-1.4 · Data.Semialign.InternalZipWithIndex Int NonEmptyDefined in semialign-1.4 · Data.Semialign.InternalZipWithIndex Int ZipListDefined in semialign-1.4 · Data.Semialign.InternalZipWithIndex Int VectorDefined in semialign-1.4 · Data.Semialign.InternalZipWithIndex Int []Defined in semialign-1.4 · Data.Semialign.InternalFilterableWithIndex Int IntMapDefined in witherable-0.5 · WitherableFilterableWithIndex Int SeqDefined in witherable-0.5 · WitherableFilterableWithIndex Int ZipListDefined in witherable-0.5 · WitherableFilterableWithIndex Int VectorDefined in witherable-0.5 · WitherableFilterableWithIndex Int []Defined in witherable-0.5 · WitherableWitherableWithIndex Int IntMapDefined in witherable-0.5 · WitherableWitherableWithIndex Int SeqDefined in witherable-0.5 · WitherableWitherableWithIndex Int ZipListDefined in witherable-0.5 · WitherableWitherableWithIndex Int VectorDefined in witherable-0.5 · WitherableWitherableWithIndex Int []Defined in witherable-0.5 · WitherableMArray IOUArray Int IODefined in array-0.5.8.0 · Data.Array.IO.InternalsGeneric1 (URec Int)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsFoldable UIntDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.FoldableTraversable UIntDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.TraversableFoldableWithIndex [Int] TreeDefined in indexed-traversable-0.1.5 · WithIndexFunctorWithIndex [Int] TreeDefined in indexed-traversable-0.1.5 · WithIndexTraversableWithIndex [Int] TreeDefined in indexed-traversable-0.1.5 · WithIndexMArray (STUArray s) Int (ST s)Defined in array-0.5.8.0 · Data.Array.BaseFunctor (URec Int)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEq (URec Int p)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsOrd (URec Int p)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsShow (URec Int p)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric (URec Int p)Defined in ghc-internal-9.1401.0 · GHC.Internal.Genericstype Rep (URec Int p) = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"URec"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"UInt"
'PrefixI 'True) (S1 ('MetaSel ('Just"uInt#"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UInt))type Rep1 (URec Int) = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"URec"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"UInt"
'PrefixI 'True) (S1 ('MetaSel ('Just"uInt#"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UInt))data URec IntDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsUsed for marking occurrences of Int#
data MVector s IntDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Basedata Vector IntDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Basetype ByteSink Int g = Takes4Bytes gDefined in uuid-types-1.0.6.1 · Data.UUID.Types.Internal.Builder
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Instances50Enum, Floating, Fractional, Data, Num, Read, …
Enum DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphanfromEnum just truncates its argument, beware of all sorts of overflows.
List generators have extremely peculiar behavior, mandated by Haskell Report 2010:
Example1 expression [0..1.5][0.0,1.0,2.0]
Eq DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.ClassesFloating DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.FloatFractional DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero.
Example4 expressions 0 == (-0 :: Double)Truerecip 0 == recip (-0 :: Double)Falsemap (/ 0) [-1, 0, 1][-Infinity,NaN,Infinity]map (* 0) $ map (/ 0) [-1, 0, 1][NaN,NaN,NaN]
Data DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.DataNum DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphanThis instance implements IEEE 754 standard with all its usual pitfalls about NaN, infinities and negative zero. Neither addition nor multiplication are associative or distributive:
Example3 expressions (0.1 + 0.1) + 0.4 == 0.1 + (0.1 + 0.4)False(0.1 + 0.2) * 0.3 == 0.1 * 0.3 + 0.2 * 0.3False(0.1 * 0.1) * 0.3 == 0.1 * (0.1 * 0.3)False
Ord DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.ClassesIEEE 754 Double-precision type includes not only numbers, but also positive and negative infinities and a special element called
NaN(which can be quiet or signal).IEEE 754-2008, section 5.11 requires that if at least one of arguments of <=, <, >, >= is
NaNthen the result of the comparison is False, andinstanceOrd Double complies with this requirement. This violates the reflexivity: bothNaN<=NaNandNaN>=NaNare False.IEEE 754-2008, section 5.10 defines
totalOrderpredicate. Unfortunately, compare on Doubles violates the IEEE standard and does not define a total order. More specifically, both compareNaNxand comparexNaNalways return GT.Thus, users must be extremely cautious when using
instanceOrd Double. For instance, one should avoid ordered containers with keys represented by Double, because data loss and corruption may happen. An IEEE-compliant compare is available infp-ieeepackage asTotallyOrderednewtype.Moving further, the behaviour of min and max with regards to
NaNis also non-compliant. IEEE 754-2008, section 5.3.1 defines that quietNaNshould be treated as a missing data byminNumandmaxNumfunctions, for example,minNum(NaN, 1) = minNum(1, NaN) = 1. Some languages such as Java deviate from the standard implementingminNum(NaN, 1) = minNum(1, NaN) = NaN. However, min / max inbaseare even worse: minNaN1 is 1, but min 1NaNisNaN.IEEE 754-2008 compliant min / max can be found in
ieee754package underminNum/maxNumnames. Implementations compliant withminimumNumber/maximumNumberfrom a newer IEEE 754-2019, section 9.6 are available fromfp-ieeepackage.Read DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.ReadReal DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphanBeware that toRational generates garbage for non-finite arguments:
Example2 expressions toRational (1/0)179769313 (and 300 more digits...) % 1toRational (0/0)269653970 (and 300 more digits...) % 1
RealFloat DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.FloatRealFrac DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphanBeware that results for non-finite arguments are garbage:
Example2 expressions [ f x | f <- [round, floor, ceiling], x <- [-1/0, 0/0, 1/0] ] :: [Int][0,0,0,0,0,0,0,0,0]map properFraction [-1/0, 0/0, 1/0] :: [(Int, Double)][(0,0.0),(0,0.0),(0,0.0)]
and get even more non-sensical if you ask for Integer instead of Int.
Show DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphanStorable DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Foreign.StorablePrintfArg DoubleDefined in base-4.22.0.0 · Text.PrintfNFData DoubleDefined in deepseq-1.5.1.0 · Control.DeepSeqPretty DoubleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJClassPretty DoubleDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClassRandom DoubleDefined in random-1.3.1 · System.RandomNote - random produces values in the closed range
[0,1].UniformRange DoubleDefined in random-1.3.1 · System.Random.InternalArbitrary DoubleDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.ArbitraryCoArbitrary DoubleDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.ArbitraryFunction DoubleDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.FunctionBinary DoubleDefined in binary-0.8.9.3 · Data.Binary.ClassUses non-IEEE754 encoding. Does not round-trip NaN.
Hashable DoubleDefined in hashable-1.5.1.0 · Data.Hashable.ClassNote: prior to
hashable-1.3.0.0,hash 0.0 /= hash (-0.0)The hash of NaN is not well defined.
Prim DoubleDefined in primitive-0.9.1.0 · Data.Primitive.TypesUnbox DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseFromJSON DoubleDefined in aeson-2.3.2.0 · Data.Aeson.Types.FromJSONFromJSONKey DoubleDefined in aeson-2.3.2.0 · Data.Aeson.Types.FromJSONToJSON DoubleDefined in aeson-2.3.2.0 · Data.Aeson.Types.ToJSONToJSONKey DoubleDefined in aeson-2.3.2.0 · Data.Aeson.Types.ToJSONUnagiPrim DoubleDefined in unagi-chan-0.4.1.4 · Control.Concurrent.Chan.Unagi.Unboxed.InternalLift DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.LiftIArray UArray DoubleDefined in array-0.5.8.0 · Data.Array.BaseMVector MVector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseVector Vector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.BaseMArray IOUArray Double IODefined in array-0.5.8.0 · Data.Array.IO.InternalsGeneric1 (URec Double)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsFoldable UDoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.FoldableTraversable UDoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.TraversableMArray (STUArray s) Double (ST s)Defined in array-0.5.8.0 · Data.Array.BaseFunctor (URec Double)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsEq (URec Double p)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsOrd (URec Double p)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsShow (URec Double p)Defined in ghc-internal-9.1401.0 · GHC.Internal.GenericsGeneric (URec Double p)Defined in ghc-internal-9.1401.0 · GHC.Internal.Genericstype Rep (URec Double p) = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"URec"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"UDouble"
'PrefixI 'True) (S1 ('MetaSel ('Just"uDouble#"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UDouble))type Rep1 (URec Double) = D1 ('MetaDataDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics"URec"
"GHC.Internal.Generics"
"ghc-internal"
'False) (C1 ('MetaCons"UDouble"
'PrefixI 'True) (S1 ('MetaSel ('Just"uDouble#"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UDouble))data URec DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.GenericsUsed for marking occurrences of Double#
data MVector s DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Basedata Vector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Base
Who may open the door
1 declarationA page that may open the door, as its browser names it
(https://vortex.openfp.net). Give one for each.
Limits
6 declarationsSeconds a connection has to finish its opening handshake (5).
The largest frame or message, in bytes (65536); a larger one ends the connection.
Seconds between the pings that keep an idle connection open (30).
Sessions open at once in all, and from one peer (64 and 4).
Each peer's frames: a burst, and a refill a second (20 and 2).
Every peer's frames together: a burst, and a refill a second (200 and 50).