HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

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 declarations
typetype String = [Char]
#

String 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.

datadata Int
#

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, …
datadata Double
#

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 · orphan

    fromEnum 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.Classes

    Note that due to the presence of NaN, Double's Eq instance does not satisfy reflexivity.

    Example1 expression
    0/0 == (0/0 :: Double)False

    Also note that Double's Eq instance does not satisfy substitutivity:

    Example2 expressions
    0 == (-0 :: Double)Truerecip 0 == recip (-0 :: Double)False
  • Floating DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float
  • Fractional DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphan

    This 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.Data
  • Num DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphan

    This 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.Classes

    IEEE 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 NaN then the result of the comparison is False, and instance Ord Double complies with this requirement. This violates the reflexivity: both NaN <= NaN and NaN >= NaN are False.

    IEEE 754-2008, section 5.10 defines totalOrder predicate. Unfortunately, compare on Doubles violates the IEEE standard and does not define a total order. More specifically, both compare NaN x and compare x NaN always return GT.

    Thus, users must be extremely cautious when using instance Ord 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 in fp-ieee package as TotallyOrdered newtype.

    Moving further, the behaviour of min and max with regards to NaN is also non-compliant. IEEE 754-2008, section 5.3.1 defines that quiet NaN should be treated as a missing data by minNum and maxNum functions, for example, minNum(NaN, 1) = minNum(1, NaN) = 1. Some languages such as Java deviate from the standard implementing minNum(NaN, 1) = minNum(1, NaN) = NaN. However, min / max in base are even worse: min NaN 1 is 1, but min 1 NaN is NaN.

    IEEE 754-2008 compliant min / max can be found in ieee754 package under minNum / maxNum names. Implementations compliant with minimumNumber / maximumNumber from a newer IEEE 754-2019, section 9.6 are available from fp-ieee package.

  • Read DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Read
  • Real DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphan

    Beware 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.Float
  • RealFrac DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Float · orphan

    Beware 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 · orphan
  • Storable DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Foreign.Storable
  • PrintfArg DoubleDefined in base-4.22.0.0 · Text.Printf
  • NFData DoubleDefined in deepseq-1.5.1.0 · Control.DeepSeq
  • Pretty DoubleDefined in pretty-1.1.3.6 · Text.PrettyPrint.Annotated.HughesPJClass
  • Pretty DoubleDefined in pretty-1.1.3.6 · Text.PrettyPrint.HughesPJClass
  • Random DoubleDefined in random-1.3.1 · System.Random

    Note - random produces values in the closed range [0,1].

  • UniformRange DoubleDefined in random-1.3.1 · System.Random.Internal
  • Arbitrary DoubleDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.Arbitrary
  • CoArbitrary DoubleDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.Arbitrary
  • Function DoubleDefined in QuickCheck-2.19.0.0 · Test.QuickCheck.Function
  • Binary DoubleDefined in binary-0.8.9.3 · Data.Binary.Class

    Uses non-IEEE754 encoding. Does not round-trip NaN.

  • Hashable DoubleDefined in hashable-1.5.1.0 · Data.Hashable.Class

    Note: 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.Types
  • Unbox DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Base
  • FromJSON DoubleDefined in aeson-2.3.2.0 · Data.Aeson.Types.FromJSON
  • FromJSONKey DoubleDefined in aeson-2.3.2.0 · Data.Aeson.Types.FromJSON
  • ToJSON DoubleDefined in aeson-2.3.2.0 · Data.Aeson.Types.ToJSON
  • ToJSONKey DoubleDefined in aeson-2.3.2.0 · Data.Aeson.Types.ToJSON
  • UnagiPrim DoubleDefined in unagi-chan-0.4.1.4 · Control.Concurrent.Chan.Unagi.Unboxed.Internal
  • Lift DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.TH.Lift
  • IArray UArray DoubleDefined in array-0.5.8.0 · Data.Array.Base
  • MVector MVector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Base
  • Vector Vector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Base
  • MArray IOUArray Double IODefined in array-0.5.8.0 · Data.Array.IO.Internals
  • Generic1 (URec Double)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Foldable UDoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Foldable
  • Traversable UDoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Data.Traversable
  • MArray (STUArray s) Double (ST s)Defined in array-0.5.8.0 · Data.Array.Base
  • Functor (URec Double)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Eq (URec Double p)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Ord (URec Double p)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Show (URec Double p)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • Generic (URec Double p)Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • type Rep (URec Double p) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UDouble" 'PrefixI 'True) (S1 ('MetaSel ('Just "uDouble#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UDouble))Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • type Rep1 (URec Double) = D1 ('MetaData "URec" "GHC.Internal.Generics" "ghc-internal" 'False) (C1 ('MetaCons "UDouble" 'PrefixI 'True) (S1 ('MetaSel ('Just "uDouble#") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) UDouble))Defined in ghc-internal-9.1401.0 · GHC.Internal.Generics
  • data URec DoubleDefined in ghc-internal-9.1401.0 · GHC.Internal.Generics

    Used for marking occurrences of Double#

  • data MVector s DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Base
  • data Vector DoubleDefined in vector-0.13.2.0 · Data.Vector.Unboxed.Base

Who may open the door

1 declaration

Limits

6 declarations
valuehandshake :: Int -> Door ()
#

Seconds a connection has to finish its opening handshake (5).

valueframeBytes :: Int -> Door ()
#

The largest frame or message, in bytes (65536); a larger one ends the connection.

valueping :: Int -> Door ()
#

Seconds between the pings that keep an idle connection open (30).

valuesessions :: Int -> Int -> Door ()
#

Sessions open at once in all, and from one peer (64 and 4).