packages feed

base 4.10.1.0 → 4.11.0.0

raw patch · 132 files changed

+4080/−2492 lines, 132 filesdep ~ghc-primdep ~integer-gmpdep ~integer-simplePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ghc-prim, integer-gmp, integer-simple, rts

API changes (from Hackage documentation)

- Control.Concurrent.Chan: isEmptyChan :: Chan a -> IO Bool
- Control.Concurrent.Chan: unGetChan :: Chan a -> a -> IO ()
- Control.Monad.Fix: instance Control.Monad.Fix.MonadFix Data.Monoid.Dual
- Control.Monad.Fix: instance Control.Monad.Fix.MonadFix Data.Monoid.Product
- Control.Monad.Fix: instance Control.Monad.Fix.MonadFix Data.Monoid.Sum
- Control.Monad.Fix: instance Control.Monad.Fix.MonadFix f => Control.Monad.Fix.MonadFix (Data.Monoid.Alt f)
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip Data.Monoid.Dual
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip Data.Monoid.Product
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip Data.Monoid.Sum
- Control.Monad.Zip: instance Control.Monad.Zip.MonadZip f => Control.Monad.Zip.MonadZip (Data.Monoid.Alt f)
- Data.Data: instance (Data.Data.Data (f a), Data.Data.Data a, Data.Typeable.Internal.Typeable f) => Data.Data.Data (Data.Monoid.Alt f a)
- Data.Data: instance Data.Data.Data Data.Monoid.All
- Data.Data: instance Data.Data.Data Data.Monoid.Any
- Data.Data: instance Data.Data.Data a => Data.Data.Data (Data.Monoid.Dual a)
- Data.Data: instance Data.Data.Data a => Data.Data.Data (Data.Monoid.Product a)
- Data.Data: instance Data.Data.Data a => Data.Data.Data (Data.Monoid.Sum a)
- Data.Data: instance forall k1 (k2 :: k1) k3 a (b :: k3). (Data.Typeable.Internal.Typeable k3, Data.Data.Data a, Data.Typeable.Internal.Typeable b) => Data.Data.Data (Data.Functor.Const.Const a b)
- Data.Data: instance forall k1 k2 (i1 :: k2) (j1 :: k1) i2 j2 (a :: i2) (b :: j2). (Data.Typeable.Internal.Typeable i2, Data.Typeable.Internal.Typeable j2, Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b, (a :: i2) ~~ (b :: j2)) => Data.Data.Data (a Data.Type.Equality.:~~: b)
- Data.Either: instance (GHC.Classes.Eq b, GHC.Classes.Eq a) => GHC.Classes.Eq (Data.Either.Either a b)
- Data.Either: instance (GHC.Classes.Ord b, GHC.Classes.Ord a) => GHC.Classes.Ord (Data.Either.Either a b)
- Data.Either: instance (GHC.Read.Read b, GHC.Read.Read a) => GHC.Read.Read (Data.Either.Either a b)
- Data.Either: instance (GHC.Show.Show b, GHC.Show.Show a) => GHC.Show.Show (Data.Either.Either a b)
- Data.Foldable: instance Data.Foldable.Foldable Data.Monoid.Dual
- Data.Foldable: instance Data.Foldable.Foldable Data.Monoid.Product
- Data.Foldable: instance Data.Foldable.Foldable Data.Monoid.Sum
- Data.Functor.Compose: instance forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2). (Data.Data.Data (f (g a)), Data.Typeable.Internal.Typeable k2, Data.Typeable.Internal.Typeable k1, Data.Typeable.Internal.Typeable g, Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable a) => Data.Data.Data (Data.Functor.Compose.Compose f g a)
- Data.Functor.Product: instance forall k (f :: k -> *) (g :: k -> *) (a :: k). (Data.Data.Data (g a), Data.Data.Data (f a), Data.Typeable.Internal.Typeable k, Data.Typeable.Internal.Typeable g, Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable a) => Data.Data.Data (Data.Functor.Product.Product f g a)
- Data.Functor.Sum: instance forall k (f :: k -> *) (g :: k -> *) (a :: k). (Data.Data.Data (g a), Data.Data.Data (f a), Data.Typeable.Internal.Typeable k, Data.Typeable.Internal.Typeable g, Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable a) => Data.Data.Data (Data.Functor.Sum.Sum f g a)
- Data.List.NonEmpty: instance Control.Monad.Fix.MonadFix Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance Control.Monad.Zip.MonadZip Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance Data.Data.Data a => Data.Data.Data (Data.List.NonEmpty.NonEmpty a)
- Data.List.NonEmpty: instance Data.Foldable.Foldable Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance Data.Functor.Classes.Eq1 Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance Data.Functor.Classes.Ord1 Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance Data.Functor.Classes.Read1 Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance Data.Functor.Classes.Show1 Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance Data.Traversable.Traversable Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance GHC.Base.Applicative Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance GHC.Base.Functor Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance GHC.Base.Monad Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.List.NonEmpty.NonEmpty a)
- Data.List.NonEmpty: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.List.NonEmpty.NonEmpty a)
- Data.List.NonEmpty: instance GHC.Exts.IsList (Data.List.NonEmpty.NonEmpty a)
- Data.List.NonEmpty: instance GHC.Generics.Generic (Data.List.NonEmpty.NonEmpty a)
- Data.List.NonEmpty: instance GHC.Generics.Generic1 Data.List.NonEmpty.NonEmpty
- Data.List.NonEmpty: instance GHC.Read.Read a => GHC.Read.Read (Data.List.NonEmpty.NonEmpty a)
- Data.List.NonEmpty: instance GHC.Show.Show a => GHC.Show.Show (Data.List.NonEmpty.NonEmpty a)
- Data.Monoid: instance GHC.Base.Alternative f => GHC.Base.Alternative (Data.Monoid.Alt f)
- Data.Monoid: instance GHC.Base.Alternative f => GHC.Base.Monoid (Data.Monoid.Alt f a)
- Data.Monoid: instance GHC.Base.Applicative Data.Monoid.Dual
- Data.Monoid: instance GHC.Base.Applicative Data.Monoid.Product
- Data.Monoid: instance GHC.Base.Applicative Data.Monoid.Sum
- Data.Monoid: instance GHC.Base.Applicative f => GHC.Base.Applicative (Data.Monoid.Alt f)
- Data.Monoid: instance GHC.Base.Functor Data.Monoid.Dual
- Data.Monoid: instance GHC.Base.Functor Data.Monoid.Product
- Data.Monoid: instance GHC.Base.Functor Data.Monoid.Sum
- Data.Monoid: instance GHC.Base.Functor f => GHC.Base.Functor (Data.Monoid.Alt f)
- Data.Monoid: instance GHC.Base.Monad Data.Monoid.Dual
- Data.Monoid: instance GHC.Base.Monad Data.Monoid.Product
- Data.Monoid: instance GHC.Base.Monad Data.Monoid.Sum
- Data.Monoid: instance GHC.Base.Monad f => GHC.Base.Monad (Data.Monoid.Alt f)
- Data.Monoid: instance GHC.Base.MonadPlus f => GHC.Base.MonadPlus (Data.Monoid.Alt f)
- Data.Monoid: instance GHC.Base.Monoid (Data.Monoid.Endo a)
- Data.Monoid: instance GHC.Base.Monoid Data.Monoid.All
- Data.Monoid: instance GHC.Base.Monoid Data.Monoid.Any
- Data.Monoid: instance GHC.Base.Monoid a => GHC.Base.Monoid (Data.Monoid.Dual a)
- Data.Monoid: instance GHC.Classes.Eq Data.Monoid.All
- Data.Monoid: instance GHC.Classes.Eq Data.Monoid.Any
- Data.Monoid: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Monoid.Dual a)
- Data.Monoid: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Monoid.Product a)
- Data.Monoid: instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Monoid.Sum a)
- Data.Monoid: instance GHC.Classes.Ord Data.Monoid.All
- Data.Monoid: instance GHC.Classes.Ord Data.Monoid.Any
- Data.Monoid: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Monoid.Dual a)
- Data.Monoid: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Monoid.Product a)
- Data.Monoid: instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Monoid.Sum a)
- Data.Monoid: instance GHC.Enum.Bounded Data.Monoid.All
- Data.Monoid: instance GHC.Enum.Bounded Data.Monoid.Any
- Data.Monoid: instance GHC.Enum.Bounded a => GHC.Enum.Bounded (Data.Monoid.Dual a)
- Data.Monoid: instance GHC.Enum.Bounded a => GHC.Enum.Bounded (Data.Monoid.Product a)
- Data.Monoid: instance GHC.Enum.Bounded a => GHC.Enum.Bounded (Data.Monoid.Sum a)
- Data.Monoid: instance GHC.Generics.Generic (Data.Monoid.Dual a)
- Data.Monoid: instance GHC.Generics.Generic (Data.Monoid.Endo a)
- Data.Monoid: instance GHC.Generics.Generic (Data.Monoid.Product a)
- Data.Monoid: instance GHC.Generics.Generic (Data.Monoid.Sum a)
- Data.Monoid: instance GHC.Generics.Generic Data.Monoid.All
- Data.Monoid: instance GHC.Generics.Generic Data.Monoid.Any
- Data.Monoid: instance GHC.Generics.Generic1 Data.Monoid.Dual
- Data.Monoid: instance GHC.Generics.Generic1 Data.Monoid.Product
- Data.Monoid: instance GHC.Generics.Generic1 Data.Monoid.Sum
- Data.Monoid: instance GHC.Num.Num a => GHC.Base.Monoid (Data.Monoid.Product a)
- Data.Monoid: instance GHC.Num.Num a => GHC.Base.Monoid (Data.Monoid.Sum a)
- Data.Monoid: instance GHC.Num.Num a => GHC.Num.Num (Data.Monoid.Product a)
- Data.Monoid: instance GHC.Num.Num a => GHC.Num.Num (Data.Monoid.Sum a)
- Data.Monoid: instance GHC.Read.Read Data.Monoid.All
- Data.Monoid: instance GHC.Read.Read Data.Monoid.Any
- Data.Monoid: instance GHC.Read.Read a => GHC.Read.Read (Data.Monoid.Dual a)
- Data.Monoid: instance GHC.Read.Read a => GHC.Read.Read (Data.Monoid.Product a)
- Data.Monoid: instance GHC.Read.Read a => GHC.Read.Read (Data.Monoid.Sum a)
- Data.Monoid: instance GHC.Show.Show Data.Monoid.All
- Data.Monoid: instance GHC.Show.Show Data.Monoid.Any
- Data.Monoid: instance GHC.Show.Show a => GHC.Show.Show (Data.Monoid.Dual a)
- Data.Monoid: instance GHC.Show.Show a => GHC.Show.Show (Data.Monoid.Product a)
- Data.Monoid: instance GHC.Show.Show a => GHC.Show.Show (Data.Monoid.Sum a)
- Data.Monoid: instance forall k (f :: k -> *) (a :: k). GHC.Classes.Eq (f a) => GHC.Classes.Eq (Data.Monoid.Alt f a)
- Data.Monoid: instance forall k (f :: k -> *) (a :: k). GHC.Classes.Ord (f a) => GHC.Classes.Ord (Data.Monoid.Alt f a)
- Data.Monoid: instance forall k (f :: k -> *) (a :: k). GHC.Enum.Enum (f a) => GHC.Enum.Enum (Data.Monoid.Alt f a)
- Data.Monoid: instance forall k (f :: k -> *) (a :: k). GHC.Generics.Generic (Data.Monoid.Alt f a)
- Data.Monoid: instance forall k (f :: k -> *) (a :: k). GHC.Num.Num (f a) => GHC.Num.Num (Data.Monoid.Alt f a)
- Data.Monoid: instance forall k (f :: k -> *) (a :: k). GHC.Read.Read (f a) => GHC.Read.Read (Data.Monoid.Alt f a)
- Data.Monoid: instance forall k (f :: k -> *) (a :: k). GHC.Show.Show (f a) => GHC.Show.Show (Data.Monoid.Alt f a)
- Data.Monoid: instance forall k (f :: k -> *). GHC.Generics.Generic1 (Data.Monoid.Alt f)
- Data.Proxy: instance forall k (s :: k). GHC.Read.Read (Data.Proxy.Proxy s)
- Data.Semigroup: class Monoid a
- Data.Semigroup: instance (Data.Data.Data b, Data.Data.Data a) => Data.Data.Data (Data.Semigroup.Arg a b)
- Data.Semigroup: instance (Data.Semigroup.Semigroup a, Data.Semigroup.Semigroup b) => Data.Semigroup.Semigroup (a, b)
- Data.Semigroup: instance (Data.Semigroup.Semigroup a, Data.Semigroup.Semigroup b, Data.Semigroup.Semigroup c) => Data.Semigroup.Semigroup (a, b, c)
- Data.Semigroup: instance (Data.Semigroup.Semigroup a, Data.Semigroup.Semigroup b, Data.Semigroup.Semigroup c, Data.Semigroup.Semigroup d) => Data.Semigroup.Semigroup (a, b, c, d)
- Data.Semigroup: instance (Data.Semigroup.Semigroup a, Data.Semigroup.Semigroup b, Data.Semigroup.Semigroup c, Data.Semigroup.Semigroup d, Data.Semigroup.Semigroup e) => Data.Semigroup.Semigroup (a, b, c, d, e)
- Data.Semigroup: instance (GHC.Read.Read b, GHC.Read.Read a) => GHC.Read.Read (Data.Semigroup.Arg a b)
- Data.Semigroup: instance (GHC.Show.Show b, GHC.Show.Show a) => GHC.Show.Show (Data.Semigroup.Arg a b)
- Data.Semigroup: instance Data.Semigroup.Semigroup ()
- Data.Semigroup: instance Data.Semigroup.Semigroup (Data.Either.Either a b)
- Data.Semigroup: instance Data.Semigroup.Semigroup (Data.List.NonEmpty.NonEmpty a)
- Data.Semigroup: instance Data.Semigroup.Semigroup (Data.Monoid.Endo a)
- Data.Semigroup: instance Data.Semigroup.Semigroup (Data.Monoid.First a)
- Data.Semigroup: instance Data.Semigroup.Semigroup (Data.Monoid.Last a)
- Data.Semigroup: instance Data.Semigroup.Semigroup (Data.Semigroup.First a)
- Data.Semigroup: instance Data.Semigroup.Semigroup (Data.Semigroup.Last a)
- Data.Semigroup: instance Data.Semigroup.Semigroup Data.Monoid.All
- Data.Semigroup: instance Data.Semigroup.Semigroup Data.Monoid.Any
- Data.Semigroup: instance Data.Semigroup.Semigroup Data.Void.Void
- Data.Semigroup: instance Data.Semigroup.Semigroup GHC.Event.Internal.Event
- Data.Semigroup: instance Data.Semigroup.Semigroup GHC.Event.Internal.Lifetime
- Data.Semigroup: instance Data.Semigroup.Semigroup GHC.Types.Ordering
- Data.Semigroup: instance Data.Semigroup.Semigroup [a]
- Data.Semigroup: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Functor.Identity.Identity a)
- Data.Semigroup: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Monoid.Dual a)
- Data.Semigroup: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Semigroup.Option a)
- Data.Semigroup: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (GHC.Base.Maybe a)
- Data.Semigroup: instance Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (GHC.Types.IO a)
- Data.Semigroup: instance Data.Semigroup.Semigroup a => GHC.Base.Monoid (Data.Semigroup.Option a)
- Data.Semigroup: instance Data.Semigroup.Semigroup b => Data.Semigroup.Semigroup (a -> b)
- Data.Semigroup: instance GHC.Base.Alternative f => Data.Semigroup.Semigroup (Data.Monoid.Alt f a)
- Data.Semigroup: instance GHC.Base.Monoid m => Data.Semigroup.Semigroup (Data.Semigroup.WrappedMonoid m)
- Data.Semigroup: instance GHC.Classes.Ord a => Data.Semigroup.Semigroup (Data.Semigroup.Max a)
- Data.Semigroup: instance GHC.Classes.Ord a => Data.Semigroup.Semigroup (Data.Semigroup.Min a)
- Data.Semigroup: instance GHC.Num.Num a => Data.Semigroup.Semigroup (Data.Monoid.Product a)
- Data.Semigroup: instance GHC.Num.Num a => Data.Semigroup.Semigroup (Data.Monoid.Sum a)
- Data.Semigroup: instance forall k (s :: k). Data.Semigroup.Semigroup (Data.Proxy.Proxy s)
- Data.Semigroup: instance forall k a (b :: k). Data.Semigroup.Semigroup a => Data.Semigroup.Semigroup (Data.Functor.Const.Const a b)
- Data.Semigroup: mappend :: Monoid a => a -> a -> a
- Data.Semigroup: mconcat :: Monoid a => [a] -> a
- Data.Semigroup: mempty :: Monoid a => a
- Data.String: instance a ~ GHC.Types.Char => Data.String.IsString [a]
- Data.Traversable: instance Data.Traversable.Traversable Data.Monoid.Dual
- Data.Traversable: instance Data.Traversable.Traversable Data.Monoid.Product
- Data.Traversable: instance Data.Traversable.Traversable Data.Monoid.Sum
- Data.Type.Equality: instance forall k (a :: k) (b :: k). a ~ b => GHC.Enum.Bounded (a Data.Type.Equality.:~: b)
- Data.Type.Equality: instance forall k (a :: k) (b :: k). a ~ b => GHC.Enum.Enum (a Data.Type.Equality.:~: b)
- Data.Type.Equality: instance forall k (a :: k) (b :: k). a ~ b => GHC.Read.Read (a Data.Type.Equality.:~: b)
- Data.Type.Equality: instance forall k (a :: k) (b :: k). a ~ b => a ~ b
- Data.Type.Equality: instance forall k2 k1 (a :: k1) (b :: k2). (a :: k1) ~~ (b :: k2) => GHC.Enum.Bounded (a Data.Type.Equality.:~~: b)
- Data.Type.Equality: instance forall k2 k1 (a :: k1) (b :: k2). (a :: k1) ~~ (b :: k2) => GHC.Enum.Enum (a Data.Type.Equality.:~~: b)
- Data.Type.Equality: instance forall k2 k1 (a :: k1) (b :: k2). (a :: k1) ~~ (b :: k2) => GHC.Read.Read (a Data.Type.Equality.:~~: b)
- Data.Typeable: type Typeable1 (a :: * -> *) = Typeable a
- Data.Typeable: type Typeable2 (a :: * -> * -> *) = Typeable a
- Data.Typeable: type Typeable3 (a :: * -> * -> * -> *) = Typeable a
- Data.Typeable: type Typeable4 (a :: * -> * -> * -> * -> *) = Typeable a
- Data.Typeable: type Typeable5 (a :: * -> * -> * -> * -> * -> *) = Typeable a
- Data.Typeable: type Typeable6 (a :: * -> * -> * -> * -> * -> * -> *) = Typeable a
- Data.Typeable: type Typeable7 (a :: * -> * -> * -> * -> * -> * -> * -> *) = Typeable a
- GHC.Generics: instance (GHC.Base.Functor g, GHC.Base.Functor f) => GHC.Base.Functor (f GHC.Generics.:*: g)
- GHC.Generics: instance (GHC.Base.Functor g, GHC.Base.Functor f) => GHC.Base.Functor (f GHC.Generics.:+: g)
- GHC.Generics: instance (GHC.Base.Functor g, GHC.Base.Functor f) => GHC.Base.Functor (f GHC.Generics.:.: g)
- GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (g p), GHC.Classes.Eq (f p)) => GHC.Classes.Eq ((GHC.Generics.:*:) f g p)
- GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (g p), GHC.Classes.Eq (f p)) => GHC.Classes.Eq ((GHC.Generics.:+:) f g p)
- GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (g p), GHC.Classes.Ord (f p)) => GHC.Classes.Ord ((GHC.Generics.:*:) f g p)
- GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (g p), GHC.Classes.Ord (f p)) => GHC.Classes.Ord ((GHC.Generics.:+:) f g p)
- GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Read.Read (g p), GHC.Read.Read (f p)) => GHC.Read.Read ((GHC.Generics.:*:) f g p)
- GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Read.Read (g p), GHC.Read.Read (f p)) => GHC.Read.Read ((GHC.Generics.:+:) f g p)
- GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Show.Show (g p), GHC.Show.Show (f p)) => GHC.Show.Show ((GHC.Generics.:*:) f g p)
- GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Show.Show (g p), GHC.Show.Show (f p)) => GHC.Show.Show ((GHC.Generics.:+:) f g p)
- GHC.Stats: GCStats :: !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Int64 -> !Double -> !Double -> !Double -> !Double -> !Double -> !Double -> !Int64 -> !Int64 -> GCStats
- GHC.Stats: [bytesAllocated] :: GCStats -> !Int64
- GHC.Stats: [bytesCopied] :: GCStats -> !Int64
- GHC.Stats: [cpuSeconds] :: GCStats -> !Double
- GHC.Stats: [cumulativeBytesUsed] :: GCStats -> !Int64
- GHC.Stats: [currentBytesSlop] :: GCStats -> !Int64
- GHC.Stats: [currentBytesUsed] :: GCStats -> !Int64
- GHC.Stats: [gcCpuSeconds] :: GCStats -> !Double
- GHC.Stats: [gcWallSeconds] :: GCStats -> !Double
- GHC.Stats: [maxBytesSlop] :: GCStats -> !Int64
- GHC.Stats: [maxBytesUsed] :: GCStats -> !Int64
- GHC.Stats: [mblocksAllocated] :: GCStats -> !Int64
- GHC.Stats: [mutatorCpuSeconds] :: GCStats -> !Double
- GHC.Stats: [mutatorWallSeconds] :: GCStats -> !Double
- GHC.Stats: [numByteUsageSamples] :: GCStats -> !Int64
- GHC.Stats: [numGcs] :: GCStats -> !Int64
- GHC.Stats: [parMaxBytesCopied] :: GCStats -> !Int64
- GHC.Stats: [parTotBytesCopied] :: GCStats -> !Int64
- GHC.Stats: [peakMegabytesAllocated] :: GCStats -> !Int64
- GHC.Stats: [wallSeconds] :: GCStats -> !Double
- GHC.Stats: data GCStats
- GHC.Stats: getGCStats :: IO GCStats
- GHC.Stats: getGCStatsEnabled :: IO Bool
- GHC.Stats: instance GHC.Read.Read GHC.Stats.GCStats
- GHC.Stats: instance GHC.Show.Show GHC.Stats.GCStats
- Numeric: (**, logBase) :: Floating a => a -> a -> a
- Numeric: asin, acos, atan :: Floating a => a -> a
- Numeric: asinh, acosh, atanh :: Floating a => a -> a
- Numeric: exp, log, sqrt :: Floating a => a -> a
- Numeric: sin, cos, tan :: Floating a => a -> a
- Numeric: sinh, cosh, tanh :: Floating a => a -> a
- Prelude: (**, logBase) :: Floating a => a -> a -> a
- Prelude: (+, -, *) :: Num a => a -> a -> a
- Prelude: asin, acos, atan :: Floating a => a -> a
- Prelude: asinh, acosh, atanh :: Floating a => a -> a
- Prelude: exp, log, sqrt :: Floating a => a -> a
- Prelude: minBound, maxBound :: Bounded a => a
- Prelude: sin, cos, tan :: Floating a => a -> a
- Prelude: sinh, cosh, tanh :: Floating a => a -> a
- Text.Printf: instance a ~ () => Text.Printf.HPrintfType (GHC.Types.IO a)
- Text.Printf: instance a ~ () => Text.Printf.PrintfType (GHC.Types.IO a)
+ Control.Applicative: instance GHC.Base.Alternative Control.Applicative.ZipList
+ Control.Exception.Base: FixIOException :: FixIOException
+ Control.Exception.Base: data FixIOException
+ Control.Monad.Fix: instance Control.Monad.Fix.MonadFix Data.Semigroup.Internal.Dual
+ Control.Monad.Fix: instance Control.Monad.Fix.MonadFix Data.Semigroup.Internal.Product
+ Control.Monad.Fix: instance Control.Monad.Fix.MonadFix Data.Semigroup.Internal.Sum
+ Control.Monad.Fix: instance Control.Monad.Fix.MonadFix GHC.Base.NonEmpty
+ Control.Monad.Fix: instance Control.Monad.Fix.MonadFix f => Control.Monad.Fix.MonadFix (Data.Semigroup.Internal.Alt f)
+ Control.Monad.Zip: instance Control.Monad.Zip.MonadZip Data.Semigroup.Internal.Dual
+ Control.Monad.Zip: instance Control.Monad.Zip.MonadZip Data.Semigroup.Internal.Product
+ Control.Monad.Zip: instance Control.Monad.Zip.MonadZip Data.Semigroup.Internal.Sum
+ Control.Monad.Zip: instance Control.Monad.Zip.MonadZip GHC.Base.NonEmpty
+ Control.Monad.Zip: instance Control.Monad.Zip.MonadZip f => Control.Monad.Zip.MonadZip (Data.Semigroup.Internal.Alt f)
+ Data.Data: instance (Data.Data.Data (f a), Data.Data.Data a, Data.Typeable.Internal.Typeable f) => Data.Data.Data (Data.Semigroup.Internal.Alt f a)
+ Data.Data: instance Data.Data.Data Data.Semigroup.Internal.All
+ Data.Data: instance Data.Data.Data Data.Semigroup.Internal.Any
+ Data.Data: instance Data.Data.Data Foreign.Ptr.IntPtr
+ Data.Data: instance Data.Data.Data Foreign.Ptr.WordPtr
+ Data.Data: instance Data.Data.Data a => Data.Data.Data (Data.Semigroup.Internal.Dual a)
+ Data.Data: instance Data.Data.Data a => Data.Data.Data (Data.Semigroup.Internal.Product a)
+ Data.Data: instance Data.Data.Data a => Data.Data.Data (Data.Semigroup.Internal.Sum a)
+ Data.Data: instance Data.Data.Data a => Data.Data.Data (GHC.Base.NonEmpty a)
+ Data.Data: instance forall i j (a :: i) (b :: j). (Data.Typeable.Internal.Typeable i, Data.Typeable.Internal.Typeable j, Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable b, (a :: i) ~~ (b :: j)) => Data.Data.Data (a Data.Type.Equality.:~~: b)
+ Data.Data: instance forall k a (b :: k). (Data.Typeable.Internal.Typeable k, Data.Data.Data a, Data.Typeable.Internal.Typeable b) => Data.Data.Data (Data.Functor.Const.Const a b)
+ Data.Either: instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (Data.Either.Either a b)
+ Data.Either: instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (Data.Either.Either a b)
+ Data.Either: instance (GHC.Read.Read a, GHC.Read.Read b) => GHC.Read.Read (Data.Either.Either a b)
+ Data.Either: instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Data.Either.Either a b)
+ Data.Either: instance GHC.Base.Semigroup (Data.Either.Either a b)
+ Data.Foldable: instance Data.Foldable.Foldable Data.Semigroup.Internal.Dual
+ Data.Foldable: instance Data.Foldable.Foldable Data.Semigroup.Internal.Product
+ Data.Foldable: instance Data.Foldable.Foldable Data.Semigroup.Internal.Sum
+ Data.Foldable: instance Data.Foldable.Foldable GHC.Base.NonEmpty
+ Data.Functor: (<&>) :: Functor f => f a -> (a -> b) -> f b
+ Data.Functor: infixl 1 <&>
+ Data.Functor.Classes: instance Data.Functor.Classes.Eq1 GHC.Base.NonEmpty
+ Data.Functor.Classes: instance Data.Functor.Classes.Ord1 GHC.Base.NonEmpty
+ Data.Functor.Classes: instance Data.Functor.Classes.Read1 GHC.Base.NonEmpty
+ Data.Functor.Classes: instance Data.Functor.Classes.Show1 GHC.Base.NonEmpty
+ Data.Functor.Compose: instance forall k1 (f :: k1 -> *) k2 (g :: k2 -> k1) (a :: k2). (Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable g, Data.Typeable.Internal.Typeable k1, Data.Typeable.Internal.Typeable k2, Data.Data.Data (f (g a))) => Data.Data.Data (Data.Functor.Compose.Compose f g a)
+ Data.Functor.Const: instance forall a k (b :: k). GHC.Base.Semigroup a => GHC.Base.Semigroup (Data.Functor.Const.Const a b)
+ Data.Functor.Identity: instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Data.Functor.Identity.Identity a)
+ Data.Functor.Product: instance forall k (f :: k -> *) (g :: k -> *) (a :: k). (Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable g, Data.Typeable.Internal.Typeable k, Data.Data.Data (f a), Data.Data.Data (g a)) => Data.Data.Data (Data.Functor.Product.Product f g a)
+ Data.Functor.Sum: instance forall k (f :: k -> *) (g :: k -> *) (a :: k). (Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable g, Data.Typeable.Internal.Typeable k, Data.Data.Data (f a), Data.Data.Data (g a)) => Data.Data.Data (Data.Functor.Sum.Sum f g a)
+ Data.List: iterate' :: (a -> a) -> a -> [a]
+ Data.List.NonEmpty: infixl 9 !!
+ Data.Monoid: instance GHC.Base.Semigroup (Data.Monoid.First a)
+ Data.Monoid: instance GHC.Base.Semigroup (Data.Monoid.Last a)
+ Data.Ord: instance GHC.Base.Applicative Data.Ord.Down
+ Data.Ord: instance GHC.Base.Functor Data.Ord.Down
+ Data.Ord: instance GHC.Base.Monad Data.Ord.Down
+ Data.Ord: instance GHC.Base.Monoid a => GHC.Base.Monoid (Data.Ord.Down a)
+ Data.Ord: instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Data.Ord.Down a)
+ Data.Ord: instance GHC.Num.Num a => GHC.Num.Num (Data.Ord.Down a)
+ Data.Proxy: instance forall k (s :: k). GHC.Base.Semigroup (Data.Proxy.Proxy s)
+ Data.Proxy: instance forall k (t :: k). GHC.Read.Read (Data.Proxy.Proxy t)
+ Data.Semigroup: instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Data.Semigroup.Arg a b)
+ Data.Semigroup: instance (GHC.Read.Read a, GHC.Read.Read b) => GHC.Read.Read (Data.Semigroup.Arg a b)
+ Data.Semigroup: instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Data.Semigroup.Arg a b)
+ Data.Semigroup: instance GHC.Base.Monoid m => GHC.Base.Semigroup (Data.Semigroup.WrappedMonoid m)
+ Data.Semigroup: instance GHC.Base.Semigroup (Data.Semigroup.First a)
+ Data.Semigroup: instance GHC.Base.Semigroup (Data.Semigroup.Last a)
+ Data.Semigroup: instance GHC.Base.Semigroup a => GHC.Base.Monoid (Data.Semigroup.Option a)
+ Data.Semigroup: instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Data.Semigroup.Option a)
+ Data.Semigroup: instance GHC.Classes.Ord a => GHC.Base.Semigroup (Data.Semigroup.Max a)
+ Data.Semigroup: instance GHC.Classes.Ord a => GHC.Base.Semigroup (Data.Semigroup.Min a)
+ Data.String: instance (a ~ GHC.Types.Char) => Data.String.IsString [a]
+ Data.Traversable: instance Data.Traversable.Traversable Data.Semigroup.Internal.Dual
+ Data.Traversable: instance Data.Traversable.Traversable Data.Semigroup.Internal.Product
+ Data.Traversable: instance Data.Traversable.Traversable Data.Semigroup.Internal.Sum
+ Data.Traversable: instance Data.Traversable.Traversable GHC.Base.NonEmpty
+ Data.Type.Equality: instance forall k (a :: k) (b :: k). (a ~ b) => GHC.Enum.Bounded (a Data.Type.Equality.:~: b)
+ Data.Type.Equality: instance forall k (a :: k) (b :: k). (a ~ b) => GHC.Enum.Enum (a Data.Type.Equality.:~: b)
+ Data.Type.Equality: instance forall k (a :: k) (b :: k). (a ~ b) => GHC.Read.Read (a Data.Type.Equality.:~: b)
+ Data.Type.Equality: instance forall k (a :: k) (b :: k). (a ~ b) => a ~ b
+ Data.Type.Equality: instance forall k2 k1 (a :: k1) (b :: k2). ((a :: k1) ~~ (b :: k2)) => GHC.Enum.Bounded (a Data.Type.Equality.:~~: b)
+ Data.Type.Equality: instance forall k2 k1 (a :: k1) (b :: k2). ((a :: k1) ~~ (b :: k2)) => GHC.Enum.Enum (a Data.Type.Equality.:~~: b)
+ Data.Type.Equality: instance forall k2 k1 (a :: k1) (b :: k2). ((a :: k1) ~~ (b :: k2)) => GHC.Read.Read (a Data.Type.Equality.:~~: b)
+ Data.Void: instance GHC.Base.Semigroup Data.Void.Void
+ GHC.ByteOrder: BigEndian :: ByteOrder
+ GHC.ByteOrder: LittleEndian :: ByteOrder
+ GHC.ByteOrder: data ByteOrder
+ GHC.ByteOrder: instance GHC.Classes.Eq GHC.ByteOrder.ByteOrder
+ GHC.ByteOrder: instance GHC.Classes.Ord GHC.ByteOrder.ByteOrder
+ GHC.ByteOrder: instance GHC.Enum.Bounded GHC.ByteOrder.ByteOrder
+ GHC.ByteOrder: instance GHC.Enum.Enum GHC.ByteOrder.ByteOrder
+ GHC.ByteOrder: instance GHC.Read.Read GHC.ByteOrder.ByteOrder
+ GHC.ByteOrder: instance GHC.Show.Show GHC.ByteOrder.ByteOrder
+ GHC.ByteOrder: targetByteOrder :: ByteOrder
+ GHC.Clock: getMonotonicTime :: IO Double
+ GHC.Clock: getMonotonicTimeNSec :: IO Word64
+ GHC.Exts: (*##) :: Double# -> Double# -> Double#
+ GHC.Exts: (*#) :: Int# -> Int# -> Int#
+ GHC.Exts: (**##) :: Double# -> Double# -> Double#
+ GHC.Exts: (+##) :: Double# -> Double# -> Double#
+ GHC.Exts: (+#) :: Int# -> Int# -> Int#
+ GHC.Exts: (-##) :: Double# -> Double# -> Double#
+ GHC.Exts: (-#) :: Int# -> Int# -> Int#
+ GHC.Exts: (/##) :: Double# -> Double# -> Double#
+ GHC.Exts: (/=##) :: Double# -> Double# -> Int#
+ GHC.Exts: (/=#) :: Int# -> Int# -> Int#
+ GHC.Exts: (<##) :: Double# -> Double# -> Int#
+ GHC.Exts: (<#) :: Int# -> Int# -> Int#
+ GHC.Exts: (<=##) :: Double# -> Double# -> Int#
+ GHC.Exts: (<=#) :: Int# -> Int# -> Int#
+ GHC.Exts: (==##) :: Double# -> Double# -> Int#
+ GHC.Exts: (==#) :: Int# -> Int# -> Int#
+ GHC.Exts: (>##) :: Double# -> Double# -> Int#
+ GHC.Exts: (>#) :: Int# -> Int# -> Int#
+ GHC.Exts: (>=##) :: Double# -> Double# -> Int#
+ GHC.Exts: (>=#) :: Int# -> Int# -> Int#
+ GHC.Exts: acosDouble# :: Double# -> Double#
+ GHC.Exts: acosFloat# :: Float# -> Float#
+ GHC.Exts: addCFinalizerToWeak# :: () => Addr# -> Addr# -> Int# -> Addr# -> Weak# b -> State# RealWorld -> (# State# RealWorld, Int# #)
+ GHC.Exts: addIntC# :: Int# -> Int# -> (# Int#, Int# #)
+ GHC.Exts: addr2Int# :: Addr# -> Int#
+ GHC.Exts: addrToAny# :: () => Addr# -> (# a #)
+ GHC.Exts: and# :: Word# -> Word# -> Word#
+ GHC.Exts: andI# :: Int# -> Int# -> Int#
+ GHC.Exts: anyToAddr# :: () => a -> State# RealWorld -> (# State# RealWorld, Addr# #)
+ GHC.Exts: asinDouble# :: Double# -> Double#
+ GHC.Exts: asinFloat# :: Float# -> Float#
+ GHC.Exts: atanDouble# :: Double# -> Double#
+ GHC.Exts: atanFloat# :: Float# -> Float#
+ GHC.Exts: atomicModifyMutVar# :: () => MutVar# d a -> a -> b -> State# d -> (# State# d, c #)
+ GHC.Exts: atomicReadIntArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: atomicWriteIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: atomically# :: () => State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: broadcastDoubleX2# :: Double# -> DoubleX2#
+ GHC.Exts: broadcastDoubleX4# :: Double# -> DoubleX4#
+ GHC.Exts: broadcastDoubleX8# :: Double# -> DoubleX8#
+ GHC.Exts: broadcastFloatX16# :: Float# -> FloatX16#
+ GHC.Exts: broadcastFloatX4# :: Float# -> FloatX4#
+ GHC.Exts: broadcastFloatX8# :: Float# -> FloatX8#
+ GHC.Exts: broadcastInt16X16# :: Int# -> Int16X16#
+ GHC.Exts: broadcastInt16X32# :: Int# -> Int16X32#
+ GHC.Exts: broadcastInt16X8# :: Int# -> Int16X8#
+ GHC.Exts: broadcastInt32X16# :: Int# -> Int32X16#
+ GHC.Exts: broadcastInt32X4# :: Int# -> Int32X4#
+ GHC.Exts: broadcastInt32X8# :: Int# -> Int32X8#
+ GHC.Exts: broadcastInt64X2# :: Int# -> Int64X2#
+ GHC.Exts: broadcastInt64X4# :: Int# -> Int64X4#
+ GHC.Exts: broadcastInt64X8# :: Int# -> Int64X8#
+ GHC.Exts: broadcastInt8X16# :: Int# -> Int8X16#
+ GHC.Exts: broadcastInt8X32# :: Int# -> Int8X32#
+ GHC.Exts: broadcastInt8X64# :: Int# -> Int8X64#
+ GHC.Exts: broadcastWord16X16# :: Word# -> Word16X16#
+ GHC.Exts: broadcastWord16X32# :: Word# -> Word16X32#
+ GHC.Exts: broadcastWord16X8# :: Word# -> Word16X8#
+ GHC.Exts: broadcastWord32X16# :: Word# -> Word32X16#
+ GHC.Exts: broadcastWord32X4# :: Word# -> Word32X4#
+ GHC.Exts: broadcastWord32X8# :: Word# -> Word32X8#
+ GHC.Exts: broadcastWord64X2# :: Word# -> Word64X2#
+ GHC.Exts: broadcastWord64X4# :: Word# -> Word64X4#
+ GHC.Exts: broadcastWord64X8# :: Word# -> Word64X8#
+ GHC.Exts: broadcastWord8X16# :: Word# -> Word8X16#
+ GHC.Exts: broadcastWord8X32# :: Word# -> Word8X32#
+ GHC.Exts: broadcastWord8X64# :: Word# -> Word8X64#
+ GHC.Exts: byteArrayContents# :: ByteArray# -> Addr#
+ GHC.Exts: byteSwap# :: Word# -> Word#
+ GHC.Exts: byteSwap16# :: Word# -> Word#
+ GHC.Exts: byteSwap32# :: Word# -> Word#
+ GHC.Exts: byteSwap64# :: Word# -> Word#
+ GHC.Exts: casArray# :: () => MutableArray# d a -> Int# -> a -> a -> State# d -> (# State# d, Int#, a #)
+ GHC.Exts: casIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: casMutVar# :: () => MutVar# d a -> a -> a -> State# d -> (# State# d, Int#, a #)
+ GHC.Exts: casSmallArray# :: () => SmallMutableArray# d a -> Int# -> a -> a -> State# d -> (# State# d, Int#, a #)
+ GHC.Exts: catch# :: () => State# RealWorld -> (# State# RealWorld, a #) -> b -> State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: catchRetry# :: () => State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: catchSTM# :: () => State# RealWorld -> (# State# RealWorld, a #) -> b -> State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: check# :: () => State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> State# RealWorld
+ GHC.Exts: chr# :: Int# -> Char#
+ GHC.Exts: clearCCS# :: () => State# d -> (# State# d, a #) -> State# d -> (# State# d, a #)
+ GHC.Exts: cloneArray# :: () => Array# a -> Int# -> Int# -> Array# a
+ GHC.Exts: cloneMutableArray# :: () => MutableArray# d a -> Int# -> Int# -> State# d -> (# State# d, MutableArray# d a #)
+ GHC.Exts: cloneSmallArray# :: () => SmallArray# a -> Int# -> Int# -> SmallArray# a
+ GHC.Exts: cloneSmallMutableArray# :: () => SmallMutableArray# d a -> Int# -> Int# -> State# d -> (# State# d, SmallMutableArray# d a #)
+ GHC.Exts: clz# :: Word# -> Word#
+ GHC.Exts: clz16# :: Word# -> Word#
+ GHC.Exts: clz32# :: Word# -> Word#
+ GHC.Exts: clz64# :: Word# -> Word#
+ GHC.Exts: clz8# :: Word# -> Word#
+ GHC.Exts: compactAdd# :: () => Compact# -> a -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: compactAddWithSharing# :: () => Compact# -> a -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: compactAllocateBlock# :: Word# -> Addr# -> State# RealWorld -> (# State# RealWorld, Addr# #)
+ GHC.Exts: compactContains# :: () => Compact# -> a -> State# RealWorld -> (# State# RealWorld, Int# #)
+ GHC.Exts: compactContainsAny# :: () => a -> State# RealWorld -> (# State# RealWorld, Int# #)
+ GHC.Exts: compactFixupPointers# :: Addr# -> Addr# -> State# RealWorld -> (# State# RealWorld, Compact#, Addr# #)
+ GHC.Exts: compactGetFirstBlock# :: Compact# -> State# RealWorld -> (# State# RealWorld, Addr#, Word# #)
+ GHC.Exts: compactGetNextBlock# :: Compact# -> Addr# -> State# RealWorld -> (# State# RealWorld, Addr#, Word# #)
+ GHC.Exts: compactNew# :: Word# -> State# RealWorld -> (# State# RealWorld, Compact# #)
+ GHC.Exts: compactResize# :: Compact# -> Word# -> State# RealWorld -> State# RealWorld
+ GHC.Exts: compactSize# :: Compact# -> State# RealWorld -> (# State# RealWorld, Word# #)
+ GHC.Exts: compareByteArrays# :: ByteArray# -> Int# -> ByteArray# -> Int# -> Int# -> Int#
+ GHC.Exts: copyAddrToByteArray# :: () => Addr# -> MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: copyArray# :: () => Array# a -> Int# -> MutableArray# d a -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: copyArrayArray# :: () => ArrayArray# -> Int# -> MutableArrayArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: copyByteArray# :: () => ByteArray# -> Int# -> MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: copyByteArrayToAddr# :: () => ByteArray# -> Int# -> Addr# -> Int# -> State# d -> State# d
+ GHC.Exts: copyMutableArray# :: () => MutableArray# d a -> Int# -> MutableArray# d a -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: copyMutableArrayArray# :: () => MutableArrayArray# d -> Int# -> MutableArrayArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: copyMutableByteArray# :: () => MutableByteArray# d -> Int# -> MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: copyMutableByteArrayToAddr# :: () => MutableByteArray# d -> Int# -> Addr# -> Int# -> State# d -> State# d
+ GHC.Exts: copySmallArray# :: () => SmallArray# a -> Int# -> SmallMutableArray# d a -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: copySmallMutableArray# :: () => SmallMutableArray# d a -> Int# -> SmallMutableArray# d a -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: cosDouble# :: Double# -> Double#
+ GHC.Exts: cosFloat# :: Float# -> Float#
+ GHC.Exts: coshDouble# :: Double# -> Double#
+ GHC.Exts: coshFloat# :: Float# -> Float#
+ GHC.Exts: ctz# :: Word# -> Word#
+ GHC.Exts: ctz16# :: Word# -> Word#
+ GHC.Exts: ctz32# :: Word# -> Word#
+ GHC.Exts: ctz64# :: Word# -> Word#
+ GHC.Exts: ctz8# :: Word# -> Word#
+ GHC.Exts: data Addr# :: TYPE AddrRep
+ GHC.Exts: data Array# (a :: *) :: TYPE UnliftedRep
+ GHC.Exts: data ArrayArray# :: TYPE UnliftedRep
+ GHC.Exts: data BCO# :: TYPE UnliftedRep
+ GHC.Exts: data ByteArray# :: TYPE UnliftedRep
+ GHC.Exts: data Char# :: TYPE WordRep
+ GHC.Exts: data Compact# :: TYPE UnliftedRep
+ GHC.Exts: data Double# :: TYPE DoubleRep
+ GHC.Exts: data DoubleX2# :: TYPE VecRep Vec2 DoubleElemRep
+ GHC.Exts: data DoubleX4# :: TYPE VecRep Vec4 DoubleElemRep
+ GHC.Exts: data DoubleX8# :: TYPE VecRep Vec8 DoubleElemRep
+ GHC.Exts: data Float# :: TYPE FloatRep
+ GHC.Exts: data FloatX16# :: TYPE VecRep Vec16 FloatElemRep
+ GHC.Exts: data FloatX4# :: TYPE VecRep Vec4 FloatElemRep
+ GHC.Exts: data FloatX8# :: TYPE VecRep Vec8 FloatElemRep
+ GHC.Exts: data Int# :: TYPE IntRep
+ GHC.Exts: data Int16X16# :: TYPE VecRep Vec16 Int16ElemRep
+ GHC.Exts: data Int16X32# :: TYPE VecRep Vec32 Int16ElemRep
+ GHC.Exts: data Int16X8# :: TYPE VecRep Vec8 Int16ElemRep
+ GHC.Exts: data Int32# :: TYPE IntRep
+ GHC.Exts: data Int32X16# :: TYPE VecRep Vec16 Int32ElemRep
+ GHC.Exts: data Int32X4# :: TYPE VecRep Vec4 Int32ElemRep
+ GHC.Exts: data Int32X8# :: TYPE VecRep Vec8 Int32ElemRep
+ GHC.Exts: data Int64# :: TYPE Int64Rep
+ GHC.Exts: data Int64X2# :: TYPE VecRep Vec2 Int64ElemRep
+ GHC.Exts: data Int64X4# :: TYPE VecRep Vec4 Int64ElemRep
+ GHC.Exts: data Int64X8# :: TYPE VecRep Vec8 Int64ElemRep
+ GHC.Exts: data Int8X16# :: TYPE VecRep Vec16 Int8ElemRep
+ GHC.Exts: data Int8X32# :: TYPE VecRep Vec32 Int8ElemRep
+ GHC.Exts: data Int8X64# :: TYPE VecRep Vec64 Int8ElemRep
+ GHC.Exts: data MVar# (a :: *) (b :: *) :: TYPE UnliftedRep
+ GHC.Exts: data MutVar# (a :: *) (b :: *) :: TYPE UnliftedRep
+ GHC.Exts: data MutableArray# (a :: *) (b :: *) :: TYPE UnliftedRep
+ GHC.Exts: data MutableArrayArray# (a :: *) :: TYPE UnliftedRep
+ GHC.Exts: data MutableByteArray# (a :: *) :: TYPE UnliftedRep
+ GHC.Exts: data RealWorld
+ GHC.Exts: data SmallArray# (a :: *) :: TYPE UnliftedRep
+ GHC.Exts: data SmallMutableArray# (a :: *) (b :: *) :: TYPE UnliftedRep
+ GHC.Exts: data StableName# (a :: *) :: TYPE UnliftedRep
+ GHC.Exts: data StablePtr# (a :: *) :: TYPE AddrRep
+ GHC.Exts: data State# (a :: *) :: TYPE TupleRep ([] :: [RuntimeRep])
+ GHC.Exts: data TVar# (a :: *) (b :: *) :: TYPE UnliftedRep
+ GHC.Exts: data ThreadId# :: TYPE UnliftedRep
+ GHC.Exts: data Void# :: TYPE TupleRep ([] :: [RuntimeRep])
+ GHC.Exts: data Weak# (a :: *) :: TYPE UnliftedRep
+ GHC.Exts: data Word# :: TYPE WordRep
+ GHC.Exts: data Word16X16# :: TYPE VecRep Vec16 Word16ElemRep
+ GHC.Exts: data Word16X32# :: TYPE VecRep Vec32 Word16ElemRep
+ GHC.Exts: data Word16X8# :: TYPE VecRep Vec8 Word16ElemRep
+ GHC.Exts: data Word32# :: TYPE WordRep
+ GHC.Exts: data Word32X16# :: TYPE VecRep Vec16 Word32ElemRep
+ GHC.Exts: data Word32X4# :: TYPE VecRep Vec4 Word32ElemRep
+ GHC.Exts: data Word32X8# :: TYPE VecRep Vec8 Word32ElemRep
+ GHC.Exts: data Word64# :: TYPE Word64Rep
+ GHC.Exts: data Word64X2# :: TYPE VecRep Vec2 Word64ElemRep
+ GHC.Exts: data Word64X4# :: TYPE VecRep Vec4 Word64ElemRep
+ GHC.Exts: data Word64X8# :: TYPE VecRep Vec8 Word64ElemRep
+ GHC.Exts: data Word8X16# :: TYPE VecRep Vec16 Word8ElemRep
+ GHC.Exts: data Word8X32# :: TYPE VecRep Vec32 Word8ElemRep
+ GHC.Exts: data Word8X64# :: TYPE VecRep Vec64 Word8ElemRep
+ GHC.Exts: data Proxy# :: forall k0. () => k0 -> TYPE TupleRep ([] :: [RuntimeRep])
+ GHC.Exts: dataToTag# :: () => a -> Int#
+ GHC.Exts: deRefStablePtr# :: () => StablePtr# a -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: deRefWeak# :: () => Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, a #)
+ GHC.Exts: decodeDouble_2Int# :: Double# -> (# Int#, Word#, Word#, Int# #)
+ GHC.Exts: decodeDouble_Int64# :: Double# -> (# Int#, Int# #)
+ GHC.Exts: decodeFloat_Int# :: Float# -> (# Int#, Int# #)
+ GHC.Exts: delay# :: () => Int# -> State# d -> State# d
+ GHC.Exts: divideDoubleX2# :: DoubleX2# -> DoubleX2# -> DoubleX2#
+ GHC.Exts: divideDoubleX4# :: DoubleX4# -> DoubleX4# -> DoubleX4#
+ GHC.Exts: divideDoubleX8# :: DoubleX8# -> DoubleX8# -> DoubleX8#
+ GHC.Exts: divideFloat# :: Float# -> Float# -> Float#
+ GHC.Exts: divideFloatX16# :: FloatX16# -> FloatX16# -> FloatX16#
+ GHC.Exts: divideFloatX4# :: FloatX4# -> FloatX4# -> FloatX4#
+ GHC.Exts: divideFloatX8# :: FloatX8# -> FloatX8# -> FloatX8#
+ GHC.Exts: double2Float# :: Double# -> Float#
+ GHC.Exts: double2Int# :: Double# -> Int#
+ GHC.Exts: eqAddr# :: Addr# -> Addr# -> Int#
+ GHC.Exts: eqChar# :: Char# -> Char# -> Int#
+ GHC.Exts: eqFloat# :: Float# -> Float# -> Int#
+ GHC.Exts: eqStableName# :: () => StableName# a -> StableName# b -> Int#
+ GHC.Exts: eqStablePtr# :: () => StablePtr# a -> StablePtr# a -> Int#
+ GHC.Exts: eqWord# :: Word# -> Word# -> Int#
+ GHC.Exts: expDouble# :: Double# -> Double#
+ GHC.Exts: expFloat# :: Float# -> Float#
+ GHC.Exts: fabsDouble# :: Double# -> Double#
+ GHC.Exts: fabsFloat# :: Float# -> Float#
+ GHC.Exts: fetchAddIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: fetchAndIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: fetchNandIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: fetchOrIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: fetchSubIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: fetchXorIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: finalizeWeak# :: () => Weak# a -> State# RealWorld -> (# State# RealWorld, Int#, State# RealWorld -> (# State# RealWorld, b #) #)
+ GHC.Exts: float2Double# :: Float# -> Double#
+ GHC.Exts: float2Int# :: Float# -> Int#
+ GHC.Exts: fork# :: () => a -> State# RealWorld -> (# State# RealWorld, ThreadId# #)
+ GHC.Exts: forkOn# :: () => Int# -> a -> State# RealWorld -> (# State# RealWorld, ThreadId# #)
+ GHC.Exts: freezeArray# :: () => MutableArray# d a -> Int# -> Int# -> State# d -> (# State# d, Array# a #)
+ GHC.Exts: freezeSmallArray# :: () => SmallMutableArray# d a -> Int# -> Int# -> State# d -> (# State# d, SmallArray# a #)
+ GHC.Exts: geAddr# :: Addr# -> Addr# -> Int#
+ GHC.Exts: geChar# :: Char# -> Char# -> Int#
+ GHC.Exts: geFloat# :: Float# -> Float# -> Int#
+ GHC.Exts: geWord# :: Word# -> Word# -> Int#
+ GHC.Exts: getApStackVal# :: () => a -> Int# -> (# Int#, b #)
+ GHC.Exts: getCCSOf# :: () => a -> State# d -> (# State# d, Addr# #)
+ GHC.Exts: getCurrentCCS# :: () => a -> State# d -> (# State# d, Addr# #)
+ GHC.Exts: getMaskingState# :: State# RealWorld -> (# State# RealWorld, Int# #)
+ GHC.Exts: getSizeofMutableByteArray# :: () => MutableByteArray# d -> State# d -> (# State# d, Int# #)
+ GHC.Exts: getSpark# :: () => State# d -> (# State# d, Int#, a #)
+ GHC.Exts: gtAddr# :: Addr# -> Addr# -> Int#
+ GHC.Exts: gtChar# :: Char# -> Char# -> Int#
+ GHC.Exts: gtFloat# :: Float# -> Float# -> Int#
+ GHC.Exts: gtWord# :: Word# -> Word# -> Int#
+ GHC.Exts: indexAddrArray# :: ByteArray# -> Int# -> Addr#
+ GHC.Exts: indexAddrOffAddr# :: Addr# -> Int# -> Addr#
+ GHC.Exts: indexArray# :: () => Array# a -> Int# -> (# a #)
+ GHC.Exts: indexArrayArrayArray# :: ArrayArray# -> Int# -> ArrayArray#
+ GHC.Exts: indexByteArrayArray# :: ArrayArray# -> Int# -> ByteArray#
+ GHC.Exts: indexCharArray# :: ByteArray# -> Int# -> Char#
+ GHC.Exts: indexCharOffAddr# :: Addr# -> Int# -> Char#
+ GHC.Exts: indexDoubleArray# :: ByteArray# -> Int# -> Double#
+ GHC.Exts: indexDoubleArrayAsDoubleX2# :: ByteArray# -> Int# -> DoubleX2#
+ GHC.Exts: indexDoubleArrayAsDoubleX4# :: ByteArray# -> Int# -> DoubleX4#
+ GHC.Exts: indexDoubleArrayAsDoubleX8# :: ByteArray# -> Int# -> DoubleX8#
+ GHC.Exts: indexDoubleOffAddr# :: Addr# -> Int# -> Double#
+ GHC.Exts: indexDoubleOffAddrAsDoubleX2# :: Addr# -> Int# -> DoubleX2#
+ GHC.Exts: indexDoubleOffAddrAsDoubleX4# :: Addr# -> Int# -> DoubleX4#
+ GHC.Exts: indexDoubleOffAddrAsDoubleX8# :: Addr# -> Int# -> DoubleX8#
+ GHC.Exts: indexDoubleX2Array# :: ByteArray# -> Int# -> DoubleX2#
+ GHC.Exts: indexDoubleX2OffAddr# :: Addr# -> Int# -> DoubleX2#
+ GHC.Exts: indexDoubleX4Array# :: ByteArray# -> Int# -> DoubleX4#
+ GHC.Exts: indexDoubleX4OffAddr# :: Addr# -> Int# -> DoubleX4#
+ GHC.Exts: indexDoubleX8Array# :: ByteArray# -> Int# -> DoubleX8#
+ GHC.Exts: indexDoubleX8OffAddr# :: Addr# -> Int# -> DoubleX8#
+ GHC.Exts: indexFloatArray# :: ByteArray# -> Int# -> Float#
+ GHC.Exts: indexFloatArrayAsFloatX16# :: ByteArray# -> Int# -> FloatX16#
+ GHC.Exts: indexFloatArrayAsFloatX4# :: ByteArray# -> Int# -> FloatX4#
+ GHC.Exts: indexFloatArrayAsFloatX8# :: ByteArray# -> Int# -> FloatX8#
+ GHC.Exts: indexFloatOffAddr# :: Addr# -> Int# -> Float#
+ GHC.Exts: indexFloatOffAddrAsFloatX16# :: Addr# -> Int# -> FloatX16#
+ GHC.Exts: indexFloatOffAddrAsFloatX4# :: Addr# -> Int# -> FloatX4#
+ GHC.Exts: indexFloatOffAddrAsFloatX8# :: Addr# -> Int# -> FloatX8#
+ GHC.Exts: indexFloatX16Array# :: ByteArray# -> Int# -> FloatX16#
+ GHC.Exts: indexFloatX16OffAddr# :: Addr# -> Int# -> FloatX16#
+ GHC.Exts: indexFloatX4Array# :: ByteArray# -> Int# -> FloatX4#
+ GHC.Exts: indexFloatX4OffAddr# :: Addr# -> Int# -> FloatX4#
+ GHC.Exts: indexFloatX8Array# :: ByteArray# -> Int# -> FloatX8#
+ GHC.Exts: indexFloatX8OffAddr# :: Addr# -> Int# -> FloatX8#
+ GHC.Exts: indexInt16Array# :: ByteArray# -> Int# -> Int#
+ GHC.Exts: indexInt16ArrayAsInt16X16# :: ByteArray# -> Int# -> Int16X16#
+ GHC.Exts: indexInt16ArrayAsInt16X32# :: ByteArray# -> Int# -> Int16X32#
+ GHC.Exts: indexInt16ArrayAsInt16X8# :: ByteArray# -> Int# -> Int16X8#
+ GHC.Exts: indexInt16OffAddr# :: Addr# -> Int# -> Int#
+ GHC.Exts: indexInt16OffAddrAsInt16X16# :: Addr# -> Int# -> Int16X16#
+ GHC.Exts: indexInt16OffAddrAsInt16X32# :: Addr# -> Int# -> Int16X32#
+ GHC.Exts: indexInt16OffAddrAsInt16X8# :: Addr# -> Int# -> Int16X8#
+ GHC.Exts: indexInt16X16Array# :: ByteArray# -> Int# -> Int16X16#
+ GHC.Exts: indexInt16X16OffAddr# :: Addr# -> Int# -> Int16X16#
+ GHC.Exts: indexInt16X32Array# :: ByteArray# -> Int# -> Int16X32#
+ GHC.Exts: indexInt16X32OffAddr# :: Addr# -> Int# -> Int16X32#
+ GHC.Exts: indexInt16X8Array# :: ByteArray# -> Int# -> Int16X8#
+ GHC.Exts: indexInt16X8OffAddr# :: Addr# -> Int# -> Int16X8#
+ GHC.Exts: indexInt32Array# :: ByteArray# -> Int# -> Int#
+ GHC.Exts: indexInt32ArrayAsInt32X16# :: ByteArray# -> Int# -> Int32X16#
+ GHC.Exts: indexInt32ArrayAsInt32X4# :: ByteArray# -> Int# -> Int32X4#
+ GHC.Exts: indexInt32ArrayAsInt32X8# :: ByteArray# -> Int# -> Int32X8#
+ GHC.Exts: indexInt32OffAddr# :: Addr# -> Int# -> Int#
+ GHC.Exts: indexInt32OffAddrAsInt32X16# :: Addr# -> Int# -> Int32X16#
+ GHC.Exts: indexInt32OffAddrAsInt32X4# :: Addr# -> Int# -> Int32X4#
+ GHC.Exts: indexInt32OffAddrAsInt32X8# :: Addr# -> Int# -> Int32X8#
+ GHC.Exts: indexInt32X16Array# :: ByteArray# -> Int# -> Int32X16#
+ GHC.Exts: indexInt32X16OffAddr# :: Addr# -> Int# -> Int32X16#
+ GHC.Exts: indexInt32X4Array# :: ByteArray# -> Int# -> Int32X4#
+ GHC.Exts: indexInt32X4OffAddr# :: Addr# -> Int# -> Int32X4#
+ GHC.Exts: indexInt32X8Array# :: ByteArray# -> Int# -> Int32X8#
+ GHC.Exts: indexInt32X8OffAddr# :: Addr# -> Int# -> Int32X8#
+ GHC.Exts: indexInt64Array# :: ByteArray# -> Int# -> Int#
+ GHC.Exts: indexInt64ArrayAsInt64X2# :: ByteArray# -> Int# -> Int64X2#
+ GHC.Exts: indexInt64ArrayAsInt64X4# :: ByteArray# -> Int# -> Int64X4#
+ GHC.Exts: indexInt64ArrayAsInt64X8# :: ByteArray# -> Int# -> Int64X8#
+ GHC.Exts: indexInt64OffAddr# :: Addr# -> Int# -> Int#
+ GHC.Exts: indexInt64OffAddrAsInt64X2# :: Addr# -> Int# -> Int64X2#
+ GHC.Exts: indexInt64OffAddrAsInt64X4# :: Addr# -> Int# -> Int64X4#
+ GHC.Exts: indexInt64OffAddrAsInt64X8# :: Addr# -> Int# -> Int64X8#
+ GHC.Exts: indexInt64X2Array# :: ByteArray# -> Int# -> Int64X2#
+ GHC.Exts: indexInt64X2OffAddr# :: Addr# -> Int# -> Int64X2#
+ GHC.Exts: indexInt64X4Array# :: ByteArray# -> Int# -> Int64X4#
+ GHC.Exts: indexInt64X4OffAddr# :: Addr# -> Int# -> Int64X4#
+ GHC.Exts: indexInt64X8Array# :: ByteArray# -> Int# -> Int64X8#
+ GHC.Exts: indexInt64X8OffAddr# :: Addr# -> Int# -> Int64X8#
+ GHC.Exts: indexInt8Array# :: ByteArray# -> Int# -> Int#
+ GHC.Exts: indexInt8ArrayAsInt8X16# :: ByteArray# -> Int# -> Int8X16#
+ GHC.Exts: indexInt8ArrayAsInt8X32# :: ByteArray# -> Int# -> Int8X32#
+ GHC.Exts: indexInt8ArrayAsInt8X64# :: ByteArray# -> Int# -> Int8X64#
+ GHC.Exts: indexInt8OffAddr# :: Addr# -> Int# -> Int#
+ GHC.Exts: indexInt8OffAddrAsInt8X16# :: Addr# -> Int# -> Int8X16#
+ GHC.Exts: indexInt8OffAddrAsInt8X32# :: Addr# -> Int# -> Int8X32#
+ GHC.Exts: indexInt8OffAddrAsInt8X64# :: Addr# -> Int# -> Int8X64#
+ GHC.Exts: indexInt8X16Array# :: ByteArray# -> Int# -> Int8X16#
+ GHC.Exts: indexInt8X16OffAddr# :: Addr# -> Int# -> Int8X16#
+ GHC.Exts: indexInt8X32Array# :: ByteArray# -> Int# -> Int8X32#
+ GHC.Exts: indexInt8X32OffAddr# :: Addr# -> Int# -> Int8X32#
+ GHC.Exts: indexInt8X64Array# :: ByteArray# -> Int# -> Int8X64#
+ GHC.Exts: indexInt8X64OffAddr# :: Addr# -> Int# -> Int8X64#
+ GHC.Exts: indexIntArray# :: ByteArray# -> Int# -> Int#
+ GHC.Exts: indexIntOffAddr# :: Addr# -> Int# -> Int#
+ GHC.Exts: indexSmallArray# :: () => SmallArray# a -> Int# -> (# a #)
+ GHC.Exts: indexStablePtrArray# :: () => ByteArray# -> Int# -> StablePtr# a
+ GHC.Exts: indexStablePtrOffAddr# :: () => Addr# -> Int# -> StablePtr# a
+ GHC.Exts: indexWideCharArray# :: ByteArray# -> Int# -> Char#
+ GHC.Exts: indexWideCharOffAddr# :: Addr# -> Int# -> Char#
+ GHC.Exts: indexWord16Array# :: ByteArray# -> Int# -> Word#
+ GHC.Exts: indexWord16ArrayAsWord16X16# :: ByteArray# -> Int# -> Word16X16#
+ GHC.Exts: indexWord16ArrayAsWord16X32# :: ByteArray# -> Int# -> Word16X32#
+ GHC.Exts: indexWord16ArrayAsWord16X8# :: ByteArray# -> Int# -> Word16X8#
+ GHC.Exts: indexWord16OffAddr# :: Addr# -> Int# -> Word#
+ GHC.Exts: indexWord16OffAddrAsWord16X16# :: Addr# -> Int# -> Word16X16#
+ GHC.Exts: indexWord16OffAddrAsWord16X32# :: Addr# -> Int# -> Word16X32#
+ GHC.Exts: indexWord16OffAddrAsWord16X8# :: Addr# -> Int# -> Word16X8#
+ GHC.Exts: indexWord16X16Array# :: ByteArray# -> Int# -> Word16X16#
+ GHC.Exts: indexWord16X16OffAddr# :: Addr# -> Int# -> Word16X16#
+ GHC.Exts: indexWord16X32Array# :: ByteArray# -> Int# -> Word16X32#
+ GHC.Exts: indexWord16X32OffAddr# :: Addr# -> Int# -> Word16X32#
+ GHC.Exts: indexWord16X8Array# :: ByteArray# -> Int# -> Word16X8#
+ GHC.Exts: indexWord16X8OffAddr# :: Addr# -> Int# -> Word16X8#
+ GHC.Exts: indexWord32Array# :: ByteArray# -> Int# -> Word#
+ GHC.Exts: indexWord32ArrayAsWord32X16# :: ByteArray# -> Int# -> Word32X16#
+ GHC.Exts: indexWord32ArrayAsWord32X4# :: ByteArray# -> Int# -> Word32X4#
+ GHC.Exts: indexWord32ArrayAsWord32X8# :: ByteArray# -> Int# -> Word32X8#
+ GHC.Exts: indexWord32OffAddr# :: Addr# -> Int# -> Word#
+ GHC.Exts: indexWord32OffAddrAsWord32X16# :: Addr# -> Int# -> Word32X16#
+ GHC.Exts: indexWord32OffAddrAsWord32X4# :: Addr# -> Int# -> Word32X4#
+ GHC.Exts: indexWord32OffAddrAsWord32X8# :: Addr# -> Int# -> Word32X8#
+ GHC.Exts: indexWord32X16Array# :: ByteArray# -> Int# -> Word32X16#
+ GHC.Exts: indexWord32X16OffAddr# :: Addr# -> Int# -> Word32X16#
+ GHC.Exts: indexWord32X4Array# :: ByteArray# -> Int# -> Word32X4#
+ GHC.Exts: indexWord32X4OffAddr# :: Addr# -> Int# -> Word32X4#
+ GHC.Exts: indexWord32X8Array# :: ByteArray# -> Int# -> Word32X8#
+ GHC.Exts: indexWord32X8OffAddr# :: Addr# -> Int# -> Word32X8#
+ GHC.Exts: indexWord64Array# :: ByteArray# -> Int# -> Word#
+ GHC.Exts: indexWord64ArrayAsWord64X2# :: ByteArray# -> Int# -> Word64X2#
+ GHC.Exts: indexWord64ArrayAsWord64X4# :: ByteArray# -> Int# -> Word64X4#
+ GHC.Exts: indexWord64ArrayAsWord64X8# :: ByteArray# -> Int# -> Word64X8#
+ GHC.Exts: indexWord64OffAddr# :: Addr# -> Int# -> Word#
+ GHC.Exts: indexWord64OffAddrAsWord64X2# :: Addr# -> Int# -> Word64X2#
+ GHC.Exts: indexWord64OffAddrAsWord64X4# :: Addr# -> Int# -> Word64X4#
+ GHC.Exts: indexWord64OffAddrAsWord64X8# :: Addr# -> Int# -> Word64X8#
+ GHC.Exts: indexWord64X2Array# :: ByteArray# -> Int# -> Word64X2#
+ GHC.Exts: indexWord64X2OffAddr# :: Addr# -> Int# -> Word64X2#
+ GHC.Exts: indexWord64X4Array# :: ByteArray# -> Int# -> Word64X4#
+ GHC.Exts: indexWord64X4OffAddr# :: Addr# -> Int# -> Word64X4#
+ GHC.Exts: indexWord64X8Array# :: ByteArray# -> Int# -> Word64X8#
+ GHC.Exts: indexWord64X8OffAddr# :: Addr# -> Int# -> Word64X8#
+ GHC.Exts: indexWord8Array# :: ByteArray# -> Int# -> Word#
+ GHC.Exts: indexWord8ArrayAsWord8X16# :: ByteArray# -> Int# -> Word8X16#
+ GHC.Exts: indexWord8ArrayAsWord8X32# :: ByteArray# -> Int# -> Word8X32#
+ GHC.Exts: indexWord8ArrayAsWord8X64# :: ByteArray# -> Int# -> Word8X64#
+ GHC.Exts: indexWord8OffAddr# :: Addr# -> Int# -> Word#
+ GHC.Exts: indexWord8OffAddrAsWord8X16# :: Addr# -> Int# -> Word8X16#
+ GHC.Exts: indexWord8OffAddrAsWord8X32# :: Addr# -> Int# -> Word8X32#
+ GHC.Exts: indexWord8OffAddrAsWord8X64# :: Addr# -> Int# -> Word8X64#
+ GHC.Exts: indexWord8X16Array# :: ByteArray# -> Int# -> Word8X16#
+ GHC.Exts: indexWord8X16OffAddr# :: Addr# -> Int# -> Word8X16#
+ GHC.Exts: indexWord8X32Array# :: ByteArray# -> Int# -> Word8X32#
+ GHC.Exts: indexWord8X32OffAddr# :: Addr# -> Int# -> Word8X32#
+ GHC.Exts: indexWord8X64Array# :: ByteArray# -> Int# -> Word8X64#
+ GHC.Exts: indexWord8X64OffAddr# :: Addr# -> Int# -> Word8X64#
+ GHC.Exts: indexWordArray# :: ByteArray# -> Int# -> Word#
+ GHC.Exts: indexWordOffAddr# :: Addr# -> Int# -> Word#
+ GHC.Exts: infix 4 <=##
+ GHC.Exts: infixl 6 -##
+ GHC.Exts: infixl 7 /##
+ GHC.Exts: insertDoubleX2# :: DoubleX2# -> Double# -> Int# -> DoubleX2#
+ GHC.Exts: insertDoubleX4# :: DoubleX4# -> Double# -> Int# -> DoubleX4#
+ GHC.Exts: insertDoubleX8# :: DoubleX8# -> Double# -> Int# -> DoubleX8#
+ GHC.Exts: insertFloatX16# :: FloatX16# -> Float# -> Int# -> FloatX16#
+ GHC.Exts: insertFloatX4# :: FloatX4# -> Float# -> Int# -> FloatX4#
+ GHC.Exts: insertFloatX8# :: FloatX8# -> Float# -> Int# -> FloatX8#
+ GHC.Exts: insertInt16X16# :: Int16X16# -> Int# -> Int# -> Int16X16#
+ GHC.Exts: insertInt16X32# :: Int16X32# -> Int# -> Int# -> Int16X32#
+ GHC.Exts: insertInt16X8# :: Int16X8# -> Int# -> Int# -> Int16X8#
+ GHC.Exts: insertInt32X16# :: Int32X16# -> Int# -> Int# -> Int32X16#
+ GHC.Exts: insertInt32X4# :: Int32X4# -> Int# -> Int# -> Int32X4#
+ GHC.Exts: insertInt32X8# :: Int32X8# -> Int# -> Int# -> Int32X8#
+ GHC.Exts: insertInt64X2# :: Int64X2# -> Int# -> Int# -> Int64X2#
+ GHC.Exts: insertInt64X4# :: Int64X4# -> Int# -> Int# -> Int64X4#
+ GHC.Exts: insertInt64X8# :: Int64X8# -> Int# -> Int# -> Int64X8#
+ GHC.Exts: insertInt8X16# :: Int8X16# -> Int# -> Int# -> Int8X16#
+ GHC.Exts: insertInt8X32# :: Int8X32# -> Int# -> Int# -> Int8X32#
+ GHC.Exts: insertInt8X64# :: Int8X64# -> Int# -> Int# -> Int8X64#
+ GHC.Exts: insertWord16X16# :: Word16X16# -> Word# -> Int# -> Word16X16#
+ GHC.Exts: insertWord16X32# :: Word16X32# -> Word# -> Int# -> Word16X32#
+ GHC.Exts: insertWord16X8# :: Word16X8# -> Word# -> Int# -> Word16X8#
+ GHC.Exts: insertWord32X16# :: Word32X16# -> Word# -> Int# -> Word32X16#
+ GHC.Exts: insertWord32X4# :: Word32X4# -> Word# -> Int# -> Word32X4#
+ GHC.Exts: insertWord32X8# :: Word32X8# -> Word# -> Int# -> Word32X8#
+ GHC.Exts: insertWord64X2# :: Word64X2# -> Word# -> Int# -> Word64X2#
+ GHC.Exts: insertWord64X4# :: Word64X4# -> Word# -> Int# -> Word64X4#
+ GHC.Exts: insertWord64X8# :: Word64X8# -> Word# -> Int# -> Word64X8#
+ GHC.Exts: insertWord8X16# :: Word8X16# -> Word# -> Int# -> Word8X16#
+ GHC.Exts: insertWord8X32# :: Word8X32# -> Word# -> Int# -> Word8X32#
+ GHC.Exts: insertWord8X64# :: Word8X64# -> Word# -> Int# -> Word8X64#
+ GHC.Exts: instance GHC.Exts.IsList (GHC.Base.NonEmpty a)
+ GHC.Exts: int2Addr# :: Int# -> Addr#
+ GHC.Exts: int2Double# :: Int# -> Double#
+ GHC.Exts: int2Float# :: Int# -> Float#
+ GHC.Exts: int2Word# :: Int# -> Word#
+ GHC.Exts: isByteArrayPinned# :: ByteArray# -> Int#
+ GHC.Exts: isCurrentThreadBound# :: State# RealWorld -> (# State# RealWorld, Int# #)
+ GHC.Exts: isEmptyMVar# :: () => MVar# d a -> State# d -> (# State# d, Int# #)
+ GHC.Exts: isMutableByteArrayPinned# :: () => MutableByteArray# d -> Int#
+ GHC.Exts: killThread# :: () => ThreadId# -> a -> State# RealWorld -> State# RealWorld
+ GHC.Exts: labelThread# :: ThreadId# -> Addr# -> State# RealWorld -> State# RealWorld
+ GHC.Exts: leAddr# :: Addr# -> Addr# -> Int#
+ GHC.Exts: leChar# :: Char# -> Char# -> Int#
+ GHC.Exts: leFloat# :: Float# -> Float# -> Int#
+ GHC.Exts: leWord# :: Word# -> Word# -> Int#
+ GHC.Exts: logDouble# :: Double# -> Double#
+ GHC.Exts: logFloat# :: Float# -> Float#
+ GHC.Exts: ltAddr# :: Addr# -> Addr# -> Int#
+ GHC.Exts: ltChar# :: Char# -> Char# -> Int#
+ GHC.Exts: ltFloat# :: Float# -> Float# -> Int#
+ GHC.Exts: ltWord# :: Word# -> Word# -> Int#
+ GHC.Exts: magicDict :: () => a
+ GHC.Exts: makeStableName# :: () => a -> State# RealWorld -> (# State# RealWorld, StableName# a #)
+ GHC.Exts: makeStablePtr# :: () => a -> State# RealWorld -> (# State# RealWorld, StablePtr# a #)
+ GHC.Exts: maskAsyncExceptions# :: () => State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: maskUninterruptible# :: () => State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: minusAddr# :: Addr# -> Addr# -> Int#
+ GHC.Exts: minusDoubleX2# :: DoubleX2# -> DoubleX2# -> DoubleX2#
+ GHC.Exts: minusDoubleX4# :: DoubleX4# -> DoubleX4# -> DoubleX4#
+ GHC.Exts: minusDoubleX8# :: DoubleX8# -> DoubleX8# -> DoubleX8#
+ GHC.Exts: minusFloat# :: Float# -> Float# -> Float#
+ GHC.Exts: minusFloatX16# :: FloatX16# -> FloatX16# -> FloatX16#
+ GHC.Exts: minusFloatX4# :: FloatX4# -> FloatX4# -> FloatX4#
+ GHC.Exts: minusFloatX8# :: FloatX8# -> FloatX8# -> FloatX8#
+ GHC.Exts: minusInt16X16# :: Int16X16# -> Int16X16# -> Int16X16#
+ GHC.Exts: minusInt16X32# :: Int16X32# -> Int16X32# -> Int16X32#
+ GHC.Exts: minusInt16X8# :: Int16X8# -> Int16X8# -> Int16X8#
+ GHC.Exts: minusInt32X16# :: Int32X16# -> Int32X16# -> Int32X16#
+ GHC.Exts: minusInt32X4# :: Int32X4# -> Int32X4# -> Int32X4#
+ GHC.Exts: minusInt32X8# :: Int32X8# -> Int32X8# -> Int32X8#
+ GHC.Exts: minusInt64X2# :: Int64X2# -> Int64X2# -> Int64X2#
+ GHC.Exts: minusInt64X4# :: Int64X4# -> Int64X4# -> Int64X4#
+ GHC.Exts: minusInt64X8# :: Int64X8# -> Int64X8# -> Int64X8#
+ GHC.Exts: minusInt8X16# :: Int8X16# -> Int8X16# -> Int8X16#
+ GHC.Exts: minusInt8X32# :: Int8X32# -> Int8X32# -> Int8X32#
+ GHC.Exts: minusInt8X64# :: Int8X64# -> Int8X64# -> Int8X64#
+ GHC.Exts: minusWord# :: Word# -> Word# -> Word#
+ GHC.Exts: minusWord16X16# :: Word16X16# -> Word16X16# -> Word16X16#
+ GHC.Exts: minusWord16X32# :: Word16X32# -> Word16X32# -> Word16X32#
+ GHC.Exts: minusWord16X8# :: Word16X8# -> Word16X8# -> Word16X8#
+ GHC.Exts: minusWord32X16# :: Word32X16# -> Word32X16# -> Word32X16#
+ GHC.Exts: minusWord32X4# :: Word32X4# -> Word32X4# -> Word32X4#
+ GHC.Exts: minusWord32X8# :: Word32X8# -> Word32X8# -> Word32X8#
+ GHC.Exts: minusWord64X2# :: Word64X2# -> Word64X2# -> Word64X2#
+ GHC.Exts: minusWord64X4# :: Word64X4# -> Word64X4# -> Word64X4#
+ GHC.Exts: minusWord64X8# :: Word64X8# -> Word64X8# -> Word64X8#
+ GHC.Exts: minusWord8X16# :: Word8X16# -> Word8X16# -> Word8X16#
+ GHC.Exts: minusWord8X32# :: Word8X32# -> Word8X32# -> Word8X32#
+ GHC.Exts: minusWord8X64# :: Word8X64# -> Word8X64# -> Word8X64#
+ GHC.Exts: mkApUpd0# :: () => BCO# -> (# a #)
+ GHC.Exts: mkWeak# :: () => a -> b -> State# RealWorld -> (# State# RealWorld, c #) -> State# RealWorld -> (# State# RealWorld, Weak# b #)
+ GHC.Exts: mkWeakNoFinalizer# :: () => a -> b -> State# RealWorld -> (# State# RealWorld, Weak# b #)
+ GHC.Exts: mulIntMayOflo# :: Int# -> Int# -> Int#
+ GHC.Exts: myThreadId# :: State# RealWorld -> (# State# RealWorld, ThreadId# #)
+ GHC.Exts: narrow16Int# :: Int# -> Int#
+ GHC.Exts: narrow16Word# :: Word# -> Word#
+ GHC.Exts: narrow32Int# :: Int# -> Int#
+ GHC.Exts: narrow32Word# :: Word# -> Word#
+ GHC.Exts: narrow8Int# :: Int# -> Int#
+ GHC.Exts: narrow8Word# :: Word# -> Word#
+ GHC.Exts: neAddr# :: Addr# -> Addr# -> Int#
+ GHC.Exts: neChar# :: Char# -> Char# -> Int#
+ GHC.Exts: neFloat# :: Float# -> Float# -> Int#
+ GHC.Exts: neWord# :: Word# -> Word# -> Int#
+ GHC.Exts: negateDouble# :: Double# -> Double#
+ GHC.Exts: negateDoubleX2# :: DoubleX2# -> DoubleX2#
+ GHC.Exts: negateDoubleX4# :: DoubleX4# -> DoubleX4#
+ GHC.Exts: negateDoubleX8# :: DoubleX8# -> DoubleX8#
+ GHC.Exts: negateFloat# :: Float# -> Float#
+ GHC.Exts: negateFloatX16# :: FloatX16# -> FloatX16#
+ GHC.Exts: negateFloatX4# :: FloatX4# -> FloatX4#
+ GHC.Exts: negateFloatX8# :: FloatX8# -> FloatX8#
+ GHC.Exts: negateInt# :: Int# -> Int#
+ GHC.Exts: negateInt16X16# :: Int16X16# -> Int16X16#
+ GHC.Exts: negateInt16X32# :: Int16X32# -> Int16X32#
+ GHC.Exts: negateInt16X8# :: Int16X8# -> Int16X8#
+ GHC.Exts: negateInt32X16# :: Int32X16# -> Int32X16#
+ GHC.Exts: negateInt32X4# :: Int32X4# -> Int32X4#
+ GHC.Exts: negateInt32X8# :: Int32X8# -> Int32X8#
+ GHC.Exts: negateInt64X2# :: Int64X2# -> Int64X2#
+ GHC.Exts: negateInt64X4# :: Int64X4# -> Int64X4#
+ GHC.Exts: negateInt64X8# :: Int64X8# -> Int64X8#
+ GHC.Exts: negateInt8X16# :: Int8X16# -> Int8X16#
+ GHC.Exts: negateInt8X32# :: Int8X32# -> Int8X32#
+ GHC.Exts: negateInt8X64# :: Int8X64# -> Int8X64#
+ GHC.Exts: newAlignedPinnedByteArray# :: () => Int# -> Int# -> State# d -> (# State# d, MutableByteArray# d #)
+ GHC.Exts: newArray# :: () => Int# -> a -> State# d -> (# State# d, MutableArray# d a #)
+ GHC.Exts: newArrayArray# :: () => Int# -> State# d -> (# State# d, MutableArrayArray# d #)
+ GHC.Exts: newBCO# :: () => ByteArray# -> ByteArray# -> Array# a -> Int# -> ByteArray# -> State# d -> (# State# d, BCO# #)
+ GHC.Exts: newByteArray# :: () => Int# -> State# d -> (# State# d, MutableByteArray# d #)
+ GHC.Exts: newMVar# :: () => State# d -> (# State# d, MVar# d a #)
+ GHC.Exts: newMutVar# :: () => a -> State# d -> (# State# d, MutVar# d a #)
+ GHC.Exts: newPinnedByteArray# :: () => Int# -> State# d -> (# State# d, MutableByteArray# d #)
+ GHC.Exts: newSmallArray# :: () => Int# -> a -> State# d -> (# State# d, SmallMutableArray# d a #)
+ GHC.Exts: newTVar# :: () => a -> State# d -> (# State# d, TVar# d a #)
+ GHC.Exts: noDuplicate# :: () => State# d -> State# d
+ GHC.Exts: not# :: Word# -> Word#
+ GHC.Exts: notI# :: Int# -> Int#
+ GHC.Exts: nullAddr# :: Addr#
+ GHC.Exts: numSparks# :: () => State# d -> (# State# d, Int# #)
+ GHC.Exts: or# :: Word# -> Word# -> Word#
+ GHC.Exts: orI# :: Int# -> Int# -> Int#
+ GHC.Exts: ord# :: Char# -> Int#
+ GHC.Exts: packDoubleX2# :: (# Double#, Double# #) -> DoubleX2#
+ GHC.Exts: packDoubleX4# :: (# Double#, Double#, Double#, Double# #) -> DoubleX4#
+ GHC.Exts: packDoubleX8# :: (# Double#, Double#, Double#, Double#, Double#, Double#, Double#, Double# #) -> DoubleX8#
+ GHC.Exts: packFloatX16# :: (# Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float# #) -> FloatX16#
+ GHC.Exts: packFloatX4# :: (# Float#, Float#, Float#, Float# #) -> FloatX4#
+ GHC.Exts: packFloatX8# :: (# Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float# #) -> FloatX8#
+ GHC.Exts: packInt16X16# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int16X16#
+ GHC.Exts: packInt16X32# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int16X32#
+ GHC.Exts: packInt16X8# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int16X8#
+ GHC.Exts: packInt32X16# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int32X16#
+ GHC.Exts: packInt32X4# :: (# Int#, Int#, Int#, Int# #) -> Int32X4#
+ GHC.Exts: packInt32X8# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int32X8#
+ GHC.Exts: packInt64X2# :: (# Int#, Int# #) -> Int64X2#
+ GHC.Exts: packInt64X4# :: (# Int#, Int#, Int#, Int# #) -> Int64X4#
+ GHC.Exts: packInt64X8# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int64X8#
+ GHC.Exts: packInt8X16# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int8X16#
+ GHC.Exts: packInt8X32# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int8X32#
+ GHC.Exts: packInt8X64# :: (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #) -> Int8X64#
+ GHC.Exts: packWord16X16# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word16X16#
+ GHC.Exts: packWord16X32# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word16X32#
+ GHC.Exts: packWord16X8# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word16X8#
+ GHC.Exts: packWord32X16# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word32X16#
+ GHC.Exts: packWord32X4# :: (# Word#, Word#, Word#, Word# #) -> Word32X4#
+ GHC.Exts: packWord32X8# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word32X8#
+ GHC.Exts: packWord64X2# :: (# Word#, Word# #) -> Word64X2#
+ GHC.Exts: packWord64X4# :: (# Word#, Word#, Word#, Word# #) -> Word64X4#
+ GHC.Exts: packWord64X8# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word64X8#
+ GHC.Exts: packWord8X16# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word8X16#
+ GHC.Exts: packWord8X32# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word8X32#
+ GHC.Exts: packWord8X64# :: (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #) -> Word8X64#
+ GHC.Exts: par# :: () => a -> Int#
+ GHC.Exts: pdep# :: Word# -> Word# -> Word#
+ GHC.Exts: pdep16# :: Word# -> Word# -> Word#
+ GHC.Exts: pdep32# :: Word# -> Word# -> Word#
+ GHC.Exts: pdep64# :: Word# -> Word# -> Word#
+ GHC.Exts: pdep8# :: Word# -> Word# -> Word#
+ GHC.Exts: pext# :: Word# -> Word# -> Word#
+ GHC.Exts: pext16# :: Word# -> Word# -> Word#
+ GHC.Exts: pext32# :: Word# -> Word# -> Word#
+ GHC.Exts: pext64# :: Word# -> Word# -> Word#
+ GHC.Exts: pext8# :: Word# -> Word# -> Word#
+ GHC.Exts: plusAddr# :: Addr# -> Int# -> Addr#
+ GHC.Exts: plusDoubleX2# :: DoubleX2# -> DoubleX2# -> DoubleX2#
+ GHC.Exts: plusDoubleX4# :: DoubleX4# -> DoubleX4# -> DoubleX4#
+ GHC.Exts: plusDoubleX8# :: DoubleX8# -> DoubleX8# -> DoubleX8#
+ GHC.Exts: plusFloat# :: Float# -> Float# -> Float#
+ GHC.Exts: plusFloatX16# :: FloatX16# -> FloatX16# -> FloatX16#
+ GHC.Exts: plusFloatX4# :: FloatX4# -> FloatX4# -> FloatX4#
+ GHC.Exts: plusFloatX8# :: FloatX8# -> FloatX8# -> FloatX8#
+ GHC.Exts: plusInt16X16# :: Int16X16# -> Int16X16# -> Int16X16#
+ GHC.Exts: plusInt16X32# :: Int16X32# -> Int16X32# -> Int16X32#
+ GHC.Exts: plusInt16X8# :: Int16X8# -> Int16X8# -> Int16X8#
+ GHC.Exts: plusInt32X16# :: Int32X16# -> Int32X16# -> Int32X16#
+ GHC.Exts: plusInt32X4# :: Int32X4# -> Int32X4# -> Int32X4#
+ GHC.Exts: plusInt32X8# :: Int32X8# -> Int32X8# -> Int32X8#
+ GHC.Exts: plusInt64X2# :: Int64X2# -> Int64X2# -> Int64X2#
+ GHC.Exts: plusInt64X4# :: Int64X4# -> Int64X4# -> Int64X4#
+ GHC.Exts: plusInt64X8# :: Int64X8# -> Int64X8# -> Int64X8#
+ GHC.Exts: plusInt8X16# :: Int8X16# -> Int8X16# -> Int8X16#
+ GHC.Exts: plusInt8X32# :: Int8X32# -> Int8X32# -> Int8X32#
+ GHC.Exts: plusInt8X64# :: Int8X64# -> Int8X64# -> Int8X64#
+ GHC.Exts: plusWord# :: Word# -> Word# -> Word#
+ GHC.Exts: plusWord16X16# :: Word16X16# -> Word16X16# -> Word16X16#
+ GHC.Exts: plusWord16X32# :: Word16X32# -> Word16X32# -> Word16X32#
+ GHC.Exts: plusWord16X8# :: Word16X8# -> Word16X8# -> Word16X8#
+ GHC.Exts: plusWord2# :: Word# -> Word# -> (# Word#, Word# #)
+ GHC.Exts: plusWord32X16# :: Word32X16# -> Word32X16# -> Word32X16#
+ GHC.Exts: plusWord32X4# :: Word32X4# -> Word32X4# -> Word32X4#
+ GHC.Exts: plusWord32X8# :: Word32X8# -> Word32X8# -> Word32X8#
+ GHC.Exts: plusWord64X2# :: Word64X2# -> Word64X2# -> Word64X2#
+ GHC.Exts: plusWord64X4# :: Word64X4# -> Word64X4# -> Word64X4#
+ GHC.Exts: plusWord64X8# :: Word64X8# -> Word64X8# -> Word64X8#
+ GHC.Exts: plusWord8X16# :: Word8X16# -> Word8X16# -> Word8X16#
+ GHC.Exts: plusWord8X32# :: Word8X32# -> Word8X32# -> Word8X32#
+ GHC.Exts: plusWord8X64# :: Word8X64# -> Word8X64# -> Word8X64#
+ GHC.Exts: popCnt# :: Word# -> Word#
+ GHC.Exts: popCnt16# :: Word# -> Word#
+ GHC.Exts: popCnt32# :: Word# -> Word#
+ GHC.Exts: popCnt64# :: Word# -> Word#
+ GHC.Exts: popCnt8# :: Word# -> Word#
+ GHC.Exts: powerFloat# :: Float# -> Float# -> Float#
+ GHC.Exts: prefetchAddr0# :: () => Addr# -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchAddr1# :: () => Addr# -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchAddr2# :: () => Addr# -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchAddr3# :: () => Addr# -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchByteArray0# :: () => ByteArray# -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchByteArray1# :: () => ByteArray# -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchByteArray2# :: () => ByteArray# -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchByteArray3# :: () => ByteArray# -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchMutableByteArray0# :: () => MutableByteArray# d -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchMutableByteArray1# :: () => MutableByteArray# d -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchMutableByteArray2# :: () => MutableByteArray# d -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchMutableByteArray3# :: () => MutableByteArray# d -> Int# -> State# d -> State# d
+ GHC.Exts: prefetchValue0# :: () => a -> State# d -> State# d
+ GHC.Exts: prefetchValue1# :: () => a -> State# d -> State# d
+ GHC.Exts: prefetchValue2# :: () => a -> State# d -> State# d
+ GHC.Exts: prefetchValue3# :: () => a -> State# d -> State# d
+ GHC.Exts: proxy# :: () => Proxy# a
+ GHC.Exts: putMVar# :: () => MVar# d a -> a -> State# d -> State# d
+ GHC.Exts: quotInt# :: Int# -> Int# -> Int#
+ GHC.Exts: quotInt16X16# :: Int16X16# -> Int16X16# -> Int16X16#
+ GHC.Exts: quotInt16X32# :: Int16X32# -> Int16X32# -> Int16X32#
+ GHC.Exts: quotInt16X8# :: Int16X8# -> Int16X8# -> Int16X8#
+ GHC.Exts: quotInt32X16# :: Int32X16# -> Int32X16# -> Int32X16#
+ GHC.Exts: quotInt32X4# :: Int32X4# -> Int32X4# -> Int32X4#
+ GHC.Exts: quotInt32X8# :: Int32X8# -> Int32X8# -> Int32X8#
+ GHC.Exts: quotInt64X2# :: Int64X2# -> Int64X2# -> Int64X2#
+ GHC.Exts: quotInt64X4# :: Int64X4# -> Int64X4# -> Int64X4#
+ GHC.Exts: quotInt64X8# :: Int64X8# -> Int64X8# -> Int64X8#
+ GHC.Exts: quotInt8X16# :: Int8X16# -> Int8X16# -> Int8X16#
+ GHC.Exts: quotInt8X32# :: Int8X32# -> Int8X32# -> Int8X32#
+ GHC.Exts: quotInt8X64# :: Int8X64# -> Int8X64# -> Int8X64#
+ GHC.Exts: quotRemInt# :: Int# -> Int# -> (# Int#, Int# #)
+ GHC.Exts: quotRemWord# :: Word# -> Word# -> (# Word#, Word# #)
+ GHC.Exts: quotRemWord2# :: Word# -> Word# -> Word# -> (# Word#, Word# #)
+ GHC.Exts: quotWord# :: Word# -> Word# -> Word#
+ GHC.Exts: quotWord16X16# :: Word16X16# -> Word16X16# -> Word16X16#
+ GHC.Exts: quotWord16X32# :: Word16X32# -> Word16X32# -> Word16X32#
+ GHC.Exts: quotWord16X8# :: Word16X8# -> Word16X8# -> Word16X8#
+ GHC.Exts: quotWord32X16# :: Word32X16# -> Word32X16# -> Word32X16#
+ GHC.Exts: quotWord32X4# :: Word32X4# -> Word32X4# -> Word32X4#
+ GHC.Exts: quotWord32X8# :: Word32X8# -> Word32X8# -> Word32X8#
+ GHC.Exts: quotWord64X2# :: Word64X2# -> Word64X2# -> Word64X2#
+ GHC.Exts: quotWord64X4# :: Word64X4# -> Word64X4# -> Word64X4#
+ GHC.Exts: quotWord64X8# :: Word64X8# -> Word64X8# -> Word64X8#
+ GHC.Exts: quotWord8X16# :: Word8X16# -> Word8X16# -> Word8X16#
+ GHC.Exts: quotWord8X32# :: Word8X32# -> Word8X32# -> Word8X32#
+ GHC.Exts: quotWord8X64# :: Word8X64# -> Word8X64# -> Word8X64#
+ GHC.Exts: raise# :: () => b -> a
+ GHC.Exts: raiseIO# :: () => a -> State# RealWorld -> (# State# RealWorld, b #)
+ GHC.Exts: readAddrArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Addr# #)
+ GHC.Exts: readAddrOffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Addr# #)
+ GHC.Exts: readArray# :: () => MutableArray# d a -> Int# -> State# d -> (# State# d, a #)
+ GHC.Exts: readArrayArrayArray# :: () => MutableArrayArray# d -> Int# -> State# d -> (# State# d, ArrayArray# #)
+ GHC.Exts: readByteArrayArray# :: () => MutableArrayArray# d -> Int# -> State# d -> (# State# d, ByteArray# #)
+ GHC.Exts: readCharArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Char# #)
+ GHC.Exts: readCharOffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Char# #)
+ GHC.Exts: readDoubleArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Double# #)
+ GHC.Exts: readDoubleArrayAsDoubleX2# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, DoubleX2# #)
+ GHC.Exts: readDoubleArrayAsDoubleX4# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, DoubleX4# #)
+ GHC.Exts: readDoubleArrayAsDoubleX8# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, DoubleX8# #)
+ GHC.Exts: readDoubleOffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Double# #)
+ GHC.Exts: readDoubleOffAddrAsDoubleX2# :: () => Addr# -> Int# -> State# d -> (# State# d, DoubleX2# #)
+ GHC.Exts: readDoubleOffAddrAsDoubleX4# :: () => Addr# -> Int# -> State# d -> (# State# d, DoubleX4# #)
+ GHC.Exts: readDoubleOffAddrAsDoubleX8# :: () => Addr# -> Int# -> State# d -> (# State# d, DoubleX8# #)
+ GHC.Exts: readDoubleX2Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, DoubleX2# #)
+ GHC.Exts: readDoubleX2OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, DoubleX2# #)
+ GHC.Exts: readDoubleX4Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, DoubleX4# #)
+ GHC.Exts: readDoubleX4OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, DoubleX4# #)
+ GHC.Exts: readDoubleX8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, DoubleX8# #)
+ GHC.Exts: readDoubleX8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, DoubleX8# #)
+ GHC.Exts: readFloatArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Float# #)
+ GHC.Exts: readFloatArrayAsFloatX16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, FloatX16# #)
+ GHC.Exts: readFloatArrayAsFloatX4# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, FloatX4# #)
+ GHC.Exts: readFloatArrayAsFloatX8# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, FloatX8# #)
+ GHC.Exts: readFloatOffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Float# #)
+ GHC.Exts: readFloatOffAddrAsFloatX16# :: () => Addr# -> Int# -> State# d -> (# State# d, FloatX16# #)
+ GHC.Exts: readFloatOffAddrAsFloatX4# :: () => Addr# -> Int# -> State# d -> (# State# d, FloatX4# #)
+ GHC.Exts: readFloatOffAddrAsFloatX8# :: () => Addr# -> Int# -> State# d -> (# State# d, FloatX8# #)
+ GHC.Exts: readFloatX16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, FloatX16# #)
+ GHC.Exts: readFloatX16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, FloatX16# #)
+ GHC.Exts: readFloatX4Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, FloatX4# #)
+ GHC.Exts: readFloatX4OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, FloatX4# #)
+ GHC.Exts: readFloatX8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, FloatX8# #)
+ GHC.Exts: readFloatX8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, FloatX8# #)
+ GHC.Exts: readInt16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readInt16ArrayAsInt16X16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int16X16# #)
+ GHC.Exts: readInt16ArrayAsInt16X32# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int16X32# #)
+ GHC.Exts: readInt16ArrayAsInt16X8# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int16X8# #)
+ GHC.Exts: readInt16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readInt16OffAddrAsInt16X16# :: () => Addr# -> Int# -> State# d -> (# State# d, Int16X16# #)
+ GHC.Exts: readInt16OffAddrAsInt16X32# :: () => Addr# -> Int# -> State# d -> (# State# d, Int16X32# #)
+ GHC.Exts: readInt16OffAddrAsInt16X8# :: () => Addr# -> Int# -> State# d -> (# State# d, Int16X8# #)
+ GHC.Exts: readInt16X16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int16X16# #)
+ GHC.Exts: readInt16X16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int16X16# #)
+ GHC.Exts: readInt16X32Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int16X32# #)
+ GHC.Exts: readInt16X32OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int16X32# #)
+ GHC.Exts: readInt16X8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int16X8# #)
+ GHC.Exts: readInt16X8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int16X8# #)
+ GHC.Exts: readInt32Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readInt32ArrayAsInt32X16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int32X16# #)
+ GHC.Exts: readInt32ArrayAsInt32X4# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int32X4# #)
+ GHC.Exts: readInt32ArrayAsInt32X8# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int32X8# #)
+ GHC.Exts: readInt32OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readInt32OffAddrAsInt32X16# :: () => Addr# -> Int# -> State# d -> (# State# d, Int32X16# #)
+ GHC.Exts: readInt32OffAddrAsInt32X4# :: () => Addr# -> Int# -> State# d -> (# State# d, Int32X4# #)
+ GHC.Exts: readInt32OffAddrAsInt32X8# :: () => Addr# -> Int# -> State# d -> (# State# d, Int32X8# #)
+ GHC.Exts: readInt32X16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int32X16# #)
+ GHC.Exts: readInt32X16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int32X16# #)
+ GHC.Exts: readInt32X4Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int32X4# #)
+ GHC.Exts: readInt32X4OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int32X4# #)
+ GHC.Exts: readInt32X8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int32X8# #)
+ GHC.Exts: readInt32X8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int32X8# #)
+ GHC.Exts: readInt64Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readInt64ArrayAsInt64X2# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int64X2# #)
+ GHC.Exts: readInt64ArrayAsInt64X4# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int64X4# #)
+ GHC.Exts: readInt64ArrayAsInt64X8# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int64X8# #)
+ GHC.Exts: readInt64OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readInt64OffAddrAsInt64X2# :: () => Addr# -> Int# -> State# d -> (# State# d, Int64X2# #)
+ GHC.Exts: readInt64OffAddrAsInt64X4# :: () => Addr# -> Int# -> State# d -> (# State# d, Int64X4# #)
+ GHC.Exts: readInt64OffAddrAsInt64X8# :: () => Addr# -> Int# -> State# d -> (# State# d, Int64X8# #)
+ GHC.Exts: readInt64X2Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int64X2# #)
+ GHC.Exts: readInt64X2OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int64X2# #)
+ GHC.Exts: readInt64X4Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int64X4# #)
+ GHC.Exts: readInt64X4OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int64X4# #)
+ GHC.Exts: readInt64X8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int64X8# #)
+ GHC.Exts: readInt64X8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int64X8# #)
+ GHC.Exts: readInt8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readInt8ArrayAsInt8X16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int8X16# #)
+ GHC.Exts: readInt8ArrayAsInt8X32# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int8X32# #)
+ GHC.Exts: readInt8ArrayAsInt8X64# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int8X64# #)
+ GHC.Exts: readInt8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readInt8OffAddrAsInt8X16# :: () => Addr# -> Int# -> State# d -> (# State# d, Int8X16# #)
+ GHC.Exts: readInt8OffAddrAsInt8X32# :: () => Addr# -> Int# -> State# d -> (# State# d, Int8X32# #)
+ GHC.Exts: readInt8OffAddrAsInt8X64# :: () => Addr# -> Int# -> State# d -> (# State# d, Int8X64# #)
+ GHC.Exts: readInt8X16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int8X16# #)
+ GHC.Exts: readInt8X16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int8X16# #)
+ GHC.Exts: readInt8X32Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int8X32# #)
+ GHC.Exts: readInt8X32OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int8X32# #)
+ GHC.Exts: readInt8X64Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int8X64# #)
+ GHC.Exts: readInt8X64OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int8X64# #)
+ GHC.Exts: readIntArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readIntOffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Int# #)
+ GHC.Exts: readMVar# :: () => MVar# d a -> State# d -> (# State# d, a #)
+ GHC.Exts: readMutVar# :: () => MutVar# d a -> State# d -> (# State# d, a #)
+ GHC.Exts: readMutableArrayArrayArray# :: () => MutableArrayArray# d -> Int# -> State# d -> (# State# d, MutableArrayArray# d #)
+ GHC.Exts: readMutableByteArrayArray# :: () => MutableArrayArray# d -> Int# -> State# d -> (# State# d, MutableByteArray# d #)
+ GHC.Exts: readSmallArray# :: () => SmallMutableArray# d a -> Int# -> State# d -> (# State# d, a #)
+ GHC.Exts: readStablePtrArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, StablePtr# a #)
+ GHC.Exts: readStablePtrOffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, StablePtr# a #)
+ GHC.Exts: readTVar# :: () => TVar# d a -> State# d -> (# State# d, a #)
+ GHC.Exts: readTVarIO# :: () => TVar# d a -> State# d -> (# State# d, a #)
+ GHC.Exts: readWideCharArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Char# #)
+ GHC.Exts: readWideCharOffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Char# #)
+ GHC.Exts: readWord16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWord16ArrayAsWord16X16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word16X16# #)
+ GHC.Exts: readWord16ArrayAsWord16X32# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word16X32# #)
+ GHC.Exts: readWord16ArrayAsWord16X8# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word16X8# #)
+ GHC.Exts: readWord16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWord16OffAddrAsWord16X16# :: () => Addr# -> Int# -> State# d -> (# State# d, Word16X16# #)
+ GHC.Exts: readWord16OffAddrAsWord16X32# :: () => Addr# -> Int# -> State# d -> (# State# d, Word16X32# #)
+ GHC.Exts: readWord16OffAddrAsWord16X8# :: () => Addr# -> Int# -> State# d -> (# State# d, Word16X8# #)
+ GHC.Exts: readWord16X16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word16X16# #)
+ GHC.Exts: readWord16X16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word16X16# #)
+ GHC.Exts: readWord16X32Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word16X32# #)
+ GHC.Exts: readWord16X32OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word16X32# #)
+ GHC.Exts: readWord16X8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word16X8# #)
+ GHC.Exts: readWord16X8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word16X8# #)
+ GHC.Exts: readWord32Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWord32ArrayAsWord32X16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word32X16# #)
+ GHC.Exts: readWord32ArrayAsWord32X4# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word32X4# #)
+ GHC.Exts: readWord32ArrayAsWord32X8# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word32X8# #)
+ GHC.Exts: readWord32OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWord32OffAddrAsWord32X16# :: () => Addr# -> Int# -> State# d -> (# State# d, Word32X16# #)
+ GHC.Exts: readWord32OffAddrAsWord32X4# :: () => Addr# -> Int# -> State# d -> (# State# d, Word32X4# #)
+ GHC.Exts: readWord32OffAddrAsWord32X8# :: () => Addr# -> Int# -> State# d -> (# State# d, Word32X8# #)
+ GHC.Exts: readWord32X16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word32X16# #)
+ GHC.Exts: readWord32X16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word32X16# #)
+ GHC.Exts: readWord32X4Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word32X4# #)
+ GHC.Exts: readWord32X4OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word32X4# #)
+ GHC.Exts: readWord32X8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word32X8# #)
+ GHC.Exts: readWord32X8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word32X8# #)
+ GHC.Exts: readWord64Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWord64ArrayAsWord64X2# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word64X2# #)
+ GHC.Exts: readWord64ArrayAsWord64X4# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word64X4# #)
+ GHC.Exts: readWord64ArrayAsWord64X8# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word64X8# #)
+ GHC.Exts: readWord64OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWord64OffAddrAsWord64X2# :: () => Addr# -> Int# -> State# d -> (# State# d, Word64X2# #)
+ GHC.Exts: readWord64OffAddrAsWord64X4# :: () => Addr# -> Int# -> State# d -> (# State# d, Word64X4# #)
+ GHC.Exts: readWord64OffAddrAsWord64X8# :: () => Addr# -> Int# -> State# d -> (# State# d, Word64X8# #)
+ GHC.Exts: readWord64X2Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word64X2# #)
+ GHC.Exts: readWord64X2OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word64X2# #)
+ GHC.Exts: readWord64X4Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word64X4# #)
+ GHC.Exts: readWord64X4OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word64X4# #)
+ GHC.Exts: readWord64X8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word64X8# #)
+ GHC.Exts: readWord64X8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word64X8# #)
+ GHC.Exts: readWord8Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWord8ArrayAsWord8X16# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word8X16# #)
+ GHC.Exts: readWord8ArrayAsWord8X32# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word8X32# #)
+ GHC.Exts: readWord8ArrayAsWord8X64# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word8X64# #)
+ GHC.Exts: readWord8OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWord8OffAddrAsWord8X16# :: () => Addr# -> Int# -> State# d -> (# State# d, Word8X16# #)
+ GHC.Exts: readWord8OffAddrAsWord8X32# :: () => Addr# -> Int# -> State# d -> (# State# d, Word8X32# #)
+ GHC.Exts: readWord8OffAddrAsWord8X64# :: () => Addr# -> Int# -> State# d -> (# State# d, Word8X64# #)
+ GHC.Exts: readWord8X16Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word8X16# #)
+ GHC.Exts: readWord8X16OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word8X16# #)
+ GHC.Exts: readWord8X32Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word8X32# #)
+ GHC.Exts: readWord8X32OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word8X32# #)
+ GHC.Exts: readWord8X64Array# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word8X64# #)
+ GHC.Exts: readWord8X64OffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word8X64# #)
+ GHC.Exts: readWordArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: readWordOffAddr# :: () => Addr# -> Int# -> State# d -> (# State# d, Word# #)
+ GHC.Exts: realWorld# :: State# RealWorld
+ GHC.Exts: reallyUnsafePtrEquality# :: () => a -> a -> Int#
+ GHC.Exts: remAddr# :: Addr# -> Int# -> Int#
+ GHC.Exts: remInt# :: Int# -> Int# -> Int#
+ GHC.Exts: remInt16X16# :: Int16X16# -> Int16X16# -> Int16X16#
+ GHC.Exts: remInt16X32# :: Int16X32# -> Int16X32# -> Int16X32#
+ GHC.Exts: remInt16X8# :: Int16X8# -> Int16X8# -> Int16X8#
+ GHC.Exts: remInt32X16# :: Int32X16# -> Int32X16# -> Int32X16#
+ GHC.Exts: remInt32X4# :: Int32X4# -> Int32X4# -> Int32X4#
+ GHC.Exts: remInt32X8# :: Int32X8# -> Int32X8# -> Int32X8#
+ GHC.Exts: remInt64X2# :: Int64X2# -> Int64X2# -> Int64X2#
+ GHC.Exts: remInt64X4# :: Int64X4# -> Int64X4# -> Int64X4#
+ GHC.Exts: remInt64X8# :: Int64X8# -> Int64X8# -> Int64X8#
+ GHC.Exts: remInt8X16# :: Int8X16# -> Int8X16# -> Int8X16#
+ GHC.Exts: remInt8X32# :: Int8X32# -> Int8X32# -> Int8X32#
+ GHC.Exts: remInt8X64# :: Int8X64# -> Int8X64# -> Int8X64#
+ GHC.Exts: remWord# :: Word# -> Word# -> Word#
+ GHC.Exts: remWord16X16# :: Word16X16# -> Word16X16# -> Word16X16#
+ GHC.Exts: remWord16X32# :: Word16X32# -> Word16X32# -> Word16X32#
+ GHC.Exts: remWord16X8# :: Word16X8# -> Word16X8# -> Word16X8#
+ GHC.Exts: remWord32X16# :: Word32X16# -> Word32X16# -> Word32X16#
+ GHC.Exts: remWord32X4# :: Word32X4# -> Word32X4# -> Word32X4#
+ GHC.Exts: remWord32X8# :: Word32X8# -> Word32X8# -> Word32X8#
+ GHC.Exts: remWord64X2# :: Word64X2# -> Word64X2# -> Word64X2#
+ GHC.Exts: remWord64X4# :: Word64X4# -> Word64X4# -> Word64X4#
+ GHC.Exts: remWord64X8# :: Word64X8# -> Word64X8# -> Word64X8#
+ GHC.Exts: remWord8X16# :: Word8X16# -> Word8X16# -> Word8X16#
+ GHC.Exts: remWord8X32# :: Word8X32# -> Word8X32# -> Word8X32#
+ GHC.Exts: remWord8X64# :: Word8X64# -> Word8X64# -> Word8X64#
+ GHC.Exts: resizeMutableByteArray# :: () => MutableByteArray# d -> Int# -> State# d -> (# State# d, MutableByteArray# d #)
+ GHC.Exts: retry# :: () => State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: sameMVar# :: () => MVar# d a -> MVar# d a -> Int#
+ GHC.Exts: sameMutVar# :: () => MutVar# d a -> MutVar# d a -> Int#
+ GHC.Exts: sameMutableArray# :: () => MutableArray# d a -> MutableArray# d a -> Int#
+ GHC.Exts: sameMutableArrayArray# :: () => MutableArrayArray# d -> MutableArrayArray# d -> Int#
+ GHC.Exts: sameMutableByteArray# :: () => MutableByteArray# d -> MutableByteArray# d -> Int#
+ GHC.Exts: sameSmallMutableArray# :: () => SmallMutableArray# d a -> SmallMutableArray# d a -> Int#
+ GHC.Exts: sameTVar# :: () => TVar# d a -> TVar# d a -> Int#
+ GHC.Exts: seq :: () => a -> b -> b
+ GHC.Exts: seq# :: () => a -> State# d -> (# State# d, a #)
+ GHC.Exts: setByteArray# :: () => MutableByteArray# d -> Int# -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: shrinkMutableByteArray# :: () => MutableByteArray# d -> Int# -> State# d -> State# d
+ GHC.Exts: sinDouble# :: Double# -> Double#
+ GHC.Exts: sinFloat# :: Float# -> Float#
+ GHC.Exts: sinhDouble# :: Double# -> Double#
+ GHC.Exts: sinhFloat# :: Float# -> Float#
+ GHC.Exts: sizeofArray# :: () => Array# a -> Int#
+ GHC.Exts: sizeofArrayArray# :: ArrayArray# -> Int#
+ GHC.Exts: sizeofByteArray# :: ByteArray# -> Int#
+ GHC.Exts: sizeofMutableArray# :: () => MutableArray# d a -> Int#
+ GHC.Exts: sizeofMutableArrayArray# :: () => MutableArrayArray# d -> Int#
+ GHC.Exts: sizeofMutableByteArray# :: () => MutableByteArray# d -> Int#
+ GHC.Exts: sizeofSmallArray# :: () => SmallArray# a -> Int#
+ GHC.Exts: sizeofSmallMutableArray# :: () => SmallMutableArray# d a -> Int#
+ GHC.Exts: spark# :: () => a -> State# d -> (# State# d, a #)
+ GHC.Exts: sqrtDouble# :: Double# -> Double#
+ GHC.Exts: sqrtFloat# :: Float# -> Float#
+ GHC.Exts: stableNameToInt# :: () => StableName# a -> Int#
+ GHC.Exts: subIntC# :: Int# -> Int# -> (# Int#, Int# #)
+ GHC.Exts: subWordC# :: Word# -> Word# -> (# Word#, Int# #)
+ GHC.Exts: tagToEnum# :: () => Int# -> a
+ GHC.Exts: takeMVar# :: () => MVar# d a -> State# d -> (# State# d, a #)
+ GHC.Exts: tanDouble# :: Double# -> Double#
+ GHC.Exts: tanFloat# :: Float# -> Float#
+ GHC.Exts: tanhDouble# :: Double# -> Double#
+ GHC.Exts: tanhFloat# :: Float# -> Float#
+ GHC.Exts: thawArray# :: () => Array# a -> Int# -> Int# -> State# d -> (# State# d, MutableArray# d a #)
+ GHC.Exts: thawSmallArray# :: () => SmallArray# a -> Int# -> Int# -> State# d -> (# State# d, SmallMutableArray# d a #)
+ GHC.Exts: threadStatus# :: ThreadId# -> State# RealWorld -> (# State# RealWorld, Int#, Int#, Int# #)
+ GHC.Exts: timesDoubleX2# :: DoubleX2# -> DoubleX2# -> DoubleX2#
+ GHC.Exts: timesDoubleX4# :: DoubleX4# -> DoubleX4# -> DoubleX4#
+ GHC.Exts: timesDoubleX8# :: DoubleX8# -> DoubleX8# -> DoubleX8#
+ GHC.Exts: timesFloat# :: Float# -> Float# -> Float#
+ GHC.Exts: timesFloatX16# :: FloatX16# -> FloatX16# -> FloatX16#
+ GHC.Exts: timesFloatX4# :: FloatX4# -> FloatX4# -> FloatX4#
+ GHC.Exts: timesFloatX8# :: FloatX8# -> FloatX8# -> FloatX8#
+ GHC.Exts: timesInt16X16# :: Int16X16# -> Int16X16# -> Int16X16#
+ GHC.Exts: timesInt16X32# :: Int16X32# -> Int16X32# -> Int16X32#
+ GHC.Exts: timesInt16X8# :: Int16X8# -> Int16X8# -> Int16X8#
+ GHC.Exts: timesInt32X16# :: Int32X16# -> Int32X16# -> Int32X16#
+ GHC.Exts: timesInt32X4# :: Int32X4# -> Int32X4# -> Int32X4#
+ GHC.Exts: timesInt32X8# :: Int32X8# -> Int32X8# -> Int32X8#
+ GHC.Exts: timesInt64X2# :: Int64X2# -> Int64X2# -> Int64X2#
+ GHC.Exts: timesInt64X4# :: Int64X4# -> Int64X4# -> Int64X4#
+ GHC.Exts: timesInt64X8# :: Int64X8# -> Int64X8# -> Int64X8#
+ GHC.Exts: timesInt8X16# :: Int8X16# -> Int8X16# -> Int8X16#
+ GHC.Exts: timesInt8X32# :: Int8X32# -> Int8X32# -> Int8X32#
+ GHC.Exts: timesInt8X64# :: Int8X64# -> Int8X64# -> Int8X64#
+ GHC.Exts: timesWord# :: Word# -> Word# -> Word#
+ GHC.Exts: timesWord16X16# :: Word16X16# -> Word16X16# -> Word16X16#
+ GHC.Exts: timesWord16X32# :: Word16X32# -> Word16X32# -> Word16X32#
+ GHC.Exts: timesWord16X8# :: Word16X8# -> Word16X8# -> Word16X8#
+ GHC.Exts: timesWord2# :: Word# -> Word# -> (# Word#, Word# #)
+ GHC.Exts: timesWord32X16# :: Word32X16# -> Word32X16# -> Word32X16#
+ GHC.Exts: timesWord32X4# :: Word32X4# -> Word32X4# -> Word32X4#
+ GHC.Exts: timesWord32X8# :: Word32X8# -> Word32X8# -> Word32X8#
+ GHC.Exts: timesWord64X2# :: Word64X2# -> Word64X2# -> Word64X2#
+ GHC.Exts: timesWord64X4# :: Word64X4# -> Word64X4# -> Word64X4#
+ GHC.Exts: timesWord64X8# :: Word64X8# -> Word64X8# -> Word64X8#
+ GHC.Exts: timesWord8X16# :: Word8X16# -> Word8X16# -> Word8X16#
+ GHC.Exts: timesWord8X32# :: Word8X32# -> Word8X32# -> Word8X32#
+ GHC.Exts: timesWord8X64# :: Word8X64# -> Word8X64# -> Word8X64#
+ GHC.Exts: touch# :: () => a -> State# RealWorld -> State# RealWorld
+ GHC.Exts: traceEvent# :: () => Addr# -> State# d -> State# d
+ GHC.Exts: traceMarker# :: () => Addr# -> State# d -> State# d
+ GHC.Exts: tryPutMVar# :: () => MVar# d a -> a -> State# d -> (# State# d, Int# #)
+ GHC.Exts: tryReadMVar# :: () => MVar# d a -> State# d -> (# State# d, Int#, a #)
+ GHC.Exts: tryTakeMVar# :: () => MVar# d a -> State# d -> (# State# d, Int#, a #)
+ GHC.Exts: uncheckedIShiftL# :: Int# -> Int# -> Int#
+ GHC.Exts: uncheckedIShiftRA# :: Int# -> Int# -> Int#
+ GHC.Exts: uncheckedIShiftRL# :: Int# -> Int# -> Int#
+ GHC.Exts: uncheckedShiftL# :: Word# -> Int# -> Word#
+ GHC.Exts: uncheckedShiftRL# :: Word# -> Int# -> Word#
+ GHC.Exts: unmaskAsyncExceptions# :: () => State# RealWorld -> (# State# RealWorld, a #) -> State# RealWorld -> (# State# RealWorld, a #)
+ GHC.Exts: unpackClosure# :: () => a -> (# Addr#, Array# b, ByteArray# #)
+ GHC.Exts: unpackDoubleX2# :: DoubleX2# -> (# Double#, Double# #)
+ GHC.Exts: unpackDoubleX4# :: DoubleX4# -> (# Double#, Double#, Double#, Double# #)
+ GHC.Exts: unpackDoubleX8# :: DoubleX8# -> (# Double#, Double#, Double#, Double#, Double#, Double#, Double#, Double# #)
+ GHC.Exts: unpackFloatX16# :: FloatX16# -> (# Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float# #)
+ GHC.Exts: unpackFloatX4# :: FloatX4# -> (# Float#, Float#, Float#, Float# #)
+ GHC.Exts: unpackFloatX8# :: FloatX8# -> (# Float#, Float#, Float#, Float#, Float#, Float#, Float#, Float# #)
+ GHC.Exts: unpackInt16X16# :: Int16X16# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt16X32# :: Int16X32# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt16X8# :: Int16X8# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt32X16# :: Int32X16# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt32X4# :: Int32X4# -> (# Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt32X8# :: Int32X8# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt64X2# :: Int64X2# -> (# Int#, Int# #)
+ GHC.Exts: unpackInt64X4# :: Int64X4# -> (# Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt64X8# :: Int64X8# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt8X16# :: Int8X16# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt8X32# :: Int8X32# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackInt8X64# :: Int8X64# -> (# Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int#, Int# #)
+ GHC.Exts: unpackWord16X16# :: Word16X16# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord16X32# :: Word16X32# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord16X8# :: Word16X8# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord32X16# :: Word32X16# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord32X4# :: Word32X4# -> (# Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord32X8# :: Word32X8# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord64X2# :: Word64X2# -> (# Word#, Word# #)
+ GHC.Exts: unpackWord64X4# :: Word64X4# -> (# Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord64X8# :: Word64X8# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord8X16# :: Word8X16# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord8X32# :: Word8X32# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unpackWord8X64# :: Word8X64# -> (# Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word#, Word# #)
+ GHC.Exts: unsafeCoerce# :: () => a -> b
+ GHC.Exts: unsafeFreezeArray# :: () => MutableArray# d a -> State# d -> (# State# d, Array# a #)
+ GHC.Exts: unsafeFreezeArrayArray# :: () => MutableArrayArray# d -> State# d -> (# State# d, ArrayArray# #)
+ GHC.Exts: unsafeFreezeByteArray# :: () => MutableByteArray# d -> State# d -> (# State# d, ByteArray# #)
+ GHC.Exts: unsafeFreezeSmallArray# :: () => SmallMutableArray# d a -> State# d -> (# State# d, SmallArray# a #)
+ GHC.Exts: unsafeThawArray# :: () => Array# a -> State# d -> (# State# d, MutableArray# d a #)
+ GHC.Exts: unsafeThawSmallArray# :: () => SmallArray# a -> State# d -> (# State# d, SmallMutableArray# d a #)
+ GHC.Exts: void# :: Void#
+ GHC.Exts: waitRead# :: () => Int# -> State# d -> State# d
+ GHC.Exts: waitWrite# :: () => Int# -> State# d -> State# d
+ GHC.Exts: word2Double# :: Word# -> Double#
+ GHC.Exts: word2Float# :: Word# -> Float#
+ GHC.Exts: word2Int# :: Word# -> Int#
+ GHC.Exts: writeAddrArray# :: () => MutableByteArray# d -> Int# -> Addr# -> State# d -> State# d
+ GHC.Exts: writeAddrOffAddr# :: () => Addr# -> Int# -> Addr# -> State# d -> State# d
+ GHC.Exts: writeArray# :: () => MutableArray# d a -> Int# -> a -> State# d -> State# d
+ GHC.Exts: writeArrayArrayArray# :: () => MutableArrayArray# d -> Int# -> ArrayArray# -> State# d -> State# d
+ GHC.Exts: writeByteArrayArray# :: () => MutableArrayArray# d -> Int# -> ByteArray# -> State# d -> State# d
+ GHC.Exts: writeCharArray# :: () => MutableByteArray# d -> Int# -> Char# -> State# d -> State# d
+ GHC.Exts: writeCharOffAddr# :: () => Addr# -> Int# -> Char# -> State# d -> State# d
+ GHC.Exts: writeDoubleArray# :: () => MutableByteArray# d -> Int# -> Double# -> State# d -> State# d
+ GHC.Exts: writeDoubleArrayAsDoubleX2# :: () => MutableByteArray# d -> Int# -> DoubleX2# -> State# d -> State# d
+ GHC.Exts: writeDoubleArrayAsDoubleX4# :: () => MutableByteArray# d -> Int# -> DoubleX4# -> State# d -> State# d
+ GHC.Exts: writeDoubleArrayAsDoubleX8# :: () => MutableByteArray# d -> Int# -> DoubleX8# -> State# d -> State# d
+ GHC.Exts: writeDoubleOffAddr# :: () => Addr# -> Int# -> Double# -> State# d -> State# d
+ GHC.Exts: writeDoubleOffAddrAsDoubleX2# :: () => Addr# -> Int# -> DoubleX2# -> State# d -> State# d
+ GHC.Exts: writeDoubleOffAddrAsDoubleX4# :: () => Addr# -> Int# -> DoubleX4# -> State# d -> State# d
+ GHC.Exts: writeDoubleOffAddrAsDoubleX8# :: () => Addr# -> Int# -> DoubleX8# -> State# d -> State# d
+ GHC.Exts: writeDoubleX2Array# :: () => MutableByteArray# d -> Int# -> DoubleX2# -> State# d -> State# d
+ GHC.Exts: writeDoubleX2OffAddr# :: () => Addr# -> Int# -> DoubleX2# -> State# d -> State# d
+ GHC.Exts: writeDoubleX4Array# :: () => MutableByteArray# d -> Int# -> DoubleX4# -> State# d -> State# d
+ GHC.Exts: writeDoubleX4OffAddr# :: () => Addr# -> Int# -> DoubleX4# -> State# d -> State# d
+ GHC.Exts: writeDoubleX8Array# :: () => MutableByteArray# d -> Int# -> DoubleX8# -> State# d -> State# d
+ GHC.Exts: writeDoubleX8OffAddr# :: () => Addr# -> Int# -> DoubleX8# -> State# d -> State# d
+ GHC.Exts: writeFloatArray# :: () => MutableByteArray# d -> Int# -> Float# -> State# d -> State# d
+ GHC.Exts: writeFloatArrayAsFloatX16# :: () => MutableByteArray# d -> Int# -> FloatX16# -> State# d -> State# d
+ GHC.Exts: writeFloatArrayAsFloatX4# :: () => MutableByteArray# d -> Int# -> FloatX4# -> State# d -> State# d
+ GHC.Exts: writeFloatArrayAsFloatX8# :: () => MutableByteArray# d -> Int# -> FloatX8# -> State# d -> State# d
+ GHC.Exts: writeFloatOffAddr# :: () => Addr# -> Int# -> Float# -> State# d -> State# d
+ GHC.Exts: writeFloatOffAddrAsFloatX16# :: () => Addr# -> Int# -> FloatX16# -> State# d -> State# d
+ GHC.Exts: writeFloatOffAddrAsFloatX4# :: () => Addr# -> Int# -> FloatX4# -> State# d -> State# d
+ GHC.Exts: writeFloatOffAddrAsFloatX8# :: () => Addr# -> Int# -> FloatX8# -> State# d -> State# d
+ GHC.Exts: writeFloatX16Array# :: () => MutableByteArray# d -> Int# -> FloatX16# -> State# d -> State# d
+ GHC.Exts: writeFloatX16OffAddr# :: () => Addr# -> Int# -> FloatX16# -> State# d -> State# d
+ GHC.Exts: writeFloatX4Array# :: () => MutableByteArray# d -> Int# -> FloatX4# -> State# d -> State# d
+ GHC.Exts: writeFloatX4OffAddr# :: () => Addr# -> Int# -> FloatX4# -> State# d -> State# d
+ GHC.Exts: writeFloatX8Array# :: () => MutableByteArray# d -> Int# -> FloatX8# -> State# d -> State# d
+ GHC.Exts: writeFloatX8OffAddr# :: () => Addr# -> Int# -> FloatX8# -> State# d -> State# d
+ GHC.Exts: writeInt16Array# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeInt16ArrayAsInt16X16# :: () => MutableByteArray# d -> Int# -> Int16X16# -> State# d -> State# d
+ GHC.Exts: writeInt16ArrayAsInt16X32# :: () => MutableByteArray# d -> Int# -> Int16X32# -> State# d -> State# d
+ GHC.Exts: writeInt16ArrayAsInt16X8# :: () => MutableByteArray# d -> Int# -> Int16X8# -> State# d -> State# d
+ GHC.Exts: writeInt16OffAddr# :: () => Addr# -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeInt16OffAddrAsInt16X16# :: () => Addr# -> Int# -> Int16X16# -> State# d -> State# d
+ GHC.Exts: writeInt16OffAddrAsInt16X32# :: () => Addr# -> Int# -> Int16X32# -> State# d -> State# d
+ GHC.Exts: writeInt16OffAddrAsInt16X8# :: () => Addr# -> Int# -> Int16X8# -> State# d -> State# d
+ GHC.Exts: writeInt16X16Array# :: () => MutableByteArray# d -> Int# -> Int16X16# -> State# d -> State# d
+ GHC.Exts: writeInt16X16OffAddr# :: () => Addr# -> Int# -> Int16X16# -> State# d -> State# d
+ GHC.Exts: writeInt16X32Array# :: () => MutableByteArray# d -> Int# -> Int16X32# -> State# d -> State# d
+ GHC.Exts: writeInt16X32OffAddr# :: () => Addr# -> Int# -> Int16X32# -> State# d -> State# d
+ GHC.Exts: writeInt16X8Array# :: () => MutableByteArray# d -> Int# -> Int16X8# -> State# d -> State# d
+ GHC.Exts: writeInt16X8OffAddr# :: () => Addr# -> Int# -> Int16X8# -> State# d -> State# d
+ GHC.Exts: writeInt32Array# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeInt32ArrayAsInt32X16# :: () => MutableByteArray# d -> Int# -> Int32X16# -> State# d -> State# d
+ GHC.Exts: writeInt32ArrayAsInt32X4# :: () => MutableByteArray# d -> Int# -> Int32X4# -> State# d -> State# d
+ GHC.Exts: writeInt32ArrayAsInt32X8# :: () => MutableByteArray# d -> Int# -> Int32X8# -> State# d -> State# d
+ GHC.Exts: writeInt32OffAddr# :: () => Addr# -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeInt32OffAddrAsInt32X16# :: () => Addr# -> Int# -> Int32X16# -> State# d -> State# d
+ GHC.Exts: writeInt32OffAddrAsInt32X4# :: () => Addr# -> Int# -> Int32X4# -> State# d -> State# d
+ GHC.Exts: writeInt32OffAddrAsInt32X8# :: () => Addr# -> Int# -> Int32X8# -> State# d -> State# d
+ GHC.Exts: writeInt32X16Array# :: () => MutableByteArray# d -> Int# -> Int32X16# -> State# d -> State# d
+ GHC.Exts: writeInt32X16OffAddr# :: () => Addr# -> Int# -> Int32X16# -> State# d -> State# d
+ GHC.Exts: writeInt32X4Array# :: () => MutableByteArray# d -> Int# -> Int32X4# -> State# d -> State# d
+ GHC.Exts: writeInt32X4OffAddr# :: () => Addr# -> Int# -> Int32X4# -> State# d -> State# d
+ GHC.Exts: writeInt32X8Array# :: () => MutableByteArray# d -> Int# -> Int32X8# -> State# d -> State# d
+ GHC.Exts: writeInt32X8OffAddr# :: () => Addr# -> Int# -> Int32X8# -> State# d -> State# d
+ GHC.Exts: writeInt64Array# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeInt64ArrayAsInt64X2# :: () => MutableByteArray# d -> Int# -> Int64X2# -> State# d -> State# d
+ GHC.Exts: writeInt64ArrayAsInt64X4# :: () => MutableByteArray# d -> Int# -> Int64X4# -> State# d -> State# d
+ GHC.Exts: writeInt64ArrayAsInt64X8# :: () => MutableByteArray# d -> Int# -> Int64X8# -> State# d -> State# d
+ GHC.Exts: writeInt64OffAddr# :: () => Addr# -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeInt64OffAddrAsInt64X2# :: () => Addr# -> Int# -> Int64X2# -> State# d -> State# d
+ GHC.Exts: writeInt64OffAddrAsInt64X4# :: () => Addr# -> Int# -> Int64X4# -> State# d -> State# d
+ GHC.Exts: writeInt64OffAddrAsInt64X8# :: () => Addr# -> Int# -> Int64X8# -> State# d -> State# d
+ GHC.Exts: writeInt64X2Array# :: () => MutableByteArray# d -> Int# -> Int64X2# -> State# d -> State# d
+ GHC.Exts: writeInt64X2OffAddr# :: () => Addr# -> Int# -> Int64X2# -> State# d -> State# d
+ GHC.Exts: writeInt64X4Array# :: () => MutableByteArray# d -> Int# -> Int64X4# -> State# d -> State# d
+ GHC.Exts: writeInt64X4OffAddr# :: () => Addr# -> Int# -> Int64X4# -> State# d -> State# d
+ GHC.Exts: writeInt64X8Array# :: () => MutableByteArray# d -> Int# -> Int64X8# -> State# d -> State# d
+ GHC.Exts: writeInt64X8OffAddr# :: () => Addr# -> Int# -> Int64X8# -> State# d -> State# d
+ GHC.Exts: writeInt8Array# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeInt8ArrayAsInt8X16# :: () => MutableByteArray# d -> Int# -> Int8X16# -> State# d -> State# d
+ GHC.Exts: writeInt8ArrayAsInt8X32# :: () => MutableByteArray# d -> Int# -> Int8X32# -> State# d -> State# d
+ GHC.Exts: writeInt8ArrayAsInt8X64# :: () => MutableByteArray# d -> Int# -> Int8X64# -> State# d -> State# d
+ GHC.Exts: writeInt8OffAddr# :: () => Addr# -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeInt8OffAddrAsInt8X16# :: () => Addr# -> Int# -> Int8X16# -> State# d -> State# d
+ GHC.Exts: writeInt8OffAddrAsInt8X32# :: () => Addr# -> Int# -> Int8X32# -> State# d -> State# d
+ GHC.Exts: writeInt8OffAddrAsInt8X64# :: () => Addr# -> Int# -> Int8X64# -> State# d -> State# d
+ GHC.Exts: writeInt8X16Array# :: () => MutableByteArray# d -> Int# -> Int8X16# -> State# d -> State# d
+ GHC.Exts: writeInt8X16OffAddr# :: () => Addr# -> Int# -> Int8X16# -> State# d -> State# d
+ GHC.Exts: writeInt8X32Array# :: () => MutableByteArray# d -> Int# -> Int8X32# -> State# d -> State# d
+ GHC.Exts: writeInt8X32OffAddr# :: () => Addr# -> Int# -> Int8X32# -> State# d -> State# d
+ GHC.Exts: writeInt8X64Array# :: () => MutableByteArray# d -> Int# -> Int8X64# -> State# d -> State# d
+ GHC.Exts: writeInt8X64OffAddr# :: () => Addr# -> Int# -> Int8X64# -> State# d -> State# d
+ GHC.Exts: writeIntArray# :: () => MutableByteArray# d -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeIntOffAddr# :: () => Addr# -> Int# -> Int# -> State# d -> State# d
+ GHC.Exts: writeMutVar# :: () => MutVar# d a -> a -> State# d -> State# d
+ GHC.Exts: writeMutableArrayArrayArray# :: () => MutableArrayArray# d -> Int# -> MutableArrayArray# d -> State# d -> State# d
+ GHC.Exts: writeMutableByteArrayArray# :: () => MutableArrayArray# d -> Int# -> MutableByteArray# d -> State# d -> State# d
+ GHC.Exts: writeSmallArray# :: () => SmallMutableArray# d a -> Int# -> a -> State# d -> State# d
+ GHC.Exts: writeStablePtrArray# :: () => MutableByteArray# d -> Int# -> StablePtr# a -> State# d -> State# d
+ GHC.Exts: writeStablePtrOffAddr# :: () => Addr# -> Int# -> StablePtr# a -> State# d -> State# d
+ GHC.Exts: writeTVar# :: () => TVar# d a -> a -> State# d -> State# d
+ GHC.Exts: writeWideCharArray# :: () => MutableByteArray# d -> Int# -> Char# -> State# d -> State# d
+ GHC.Exts: writeWideCharOffAddr# :: () => Addr# -> Int# -> Char# -> State# d -> State# d
+ GHC.Exts: writeWord16Array# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWord16ArrayAsWord16X16# :: () => MutableByteArray# d -> Int# -> Word16X16# -> State# d -> State# d
+ GHC.Exts: writeWord16ArrayAsWord16X32# :: () => MutableByteArray# d -> Int# -> Word16X32# -> State# d -> State# d
+ GHC.Exts: writeWord16ArrayAsWord16X8# :: () => MutableByteArray# d -> Int# -> Word16X8# -> State# d -> State# d
+ GHC.Exts: writeWord16OffAddr# :: () => Addr# -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWord16OffAddrAsWord16X16# :: () => Addr# -> Int# -> Word16X16# -> State# d -> State# d
+ GHC.Exts: writeWord16OffAddrAsWord16X32# :: () => Addr# -> Int# -> Word16X32# -> State# d -> State# d
+ GHC.Exts: writeWord16OffAddrAsWord16X8# :: () => Addr# -> Int# -> Word16X8# -> State# d -> State# d
+ GHC.Exts: writeWord16X16Array# :: () => MutableByteArray# d -> Int# -> Word16X16# -> State# d -> State# d
+ GHC.Exts: writeWord16X16OffAddr# :: () => Addr# -> Int# -> Word16X16# -> State# d -> State# d
+ GHC.Exts: writeWord16X32Array# :: () => MutableByteArray# d -> Int# -> Word16X32# -> State# d -> State# d
+ GHC.Exts: writeWord16X32OffAddr# :: () => Addr# -> Int# -> Word16X32# -> State# d -> State# d
+ GHC.Exts: writeWord16X8Array# :: () => MutableByteArray# d -> Int# -> Word16X8# -> State# d -> State# d
+ GHC.Exts: writeWord16X8OffAddr# :: () => Addr# -> Int# -> Word16X8# -> State# d -> State# d
+ GHC.Exts: writeWord32Array# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWord32ArrayAsWord32X16# :: () => MutableByteArray# d -> Int# -> Word32X16# -> State# d -> State# d
+ GHC.Exts: writeWord32ArrayAsWord32X4# :: () => MutableByteArray# d -> Int# -> Word32X4# -> State# d -> State# d
+ GHC.Exts: writeWord32ArrayAsWord32X8# :: () => MutableByteArray# d -> Int# -> Word32X8# -> State# d -> State# d
+ GHC.Exts: writeWord32OffAddr# :: () => Addr# -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWord32OffAddrAsWord32X16# :: () => Addr# -> Int# -> Word32X16# -> State# d -> State# d
+ GHC.Exts: writeWord32OffAddrAsWord32X4# :: () => Addr# -> Int# -> Word32X4# -> State# d -> State# d
+ GHC.Exts: writeWord32OffAddrAsWord32X8# :: () => Addr# -> Int# -> Word32X8# -> State# d -> State# d
+ GHC.Exts: writeWord32X16Array# :: () => MutableByteArray# d -> Int# -> Word32X16# -> State# d -> State# d
+ GHC.Exts: writeWord32X16OffAddr# :: () => Addr# -> Int# -> Word32X16# -> State# d -> State# d
+ GHC.Exts: writeWord32X4Array# :: () => MutableByteArray# d -> Int# -> Word32X4# -> State# d -> State# d
+ GHC.Exts: writeWord32X4OffAddr# :: () => Addr# -> Int# -> Word32X4# -> State# d -> State# d
+ GHC.Exts: writeWord32X8Array# :: () => MutableByteArray# d -> Int# -> Word32X8# -> State# d -> State# d
+ GHC.Exts: writeWord32X8OffAddr# :: () => Addr# -> Int# -> Word32X8# -> State# d -> State# d
+ GHC.Exts: writeWord64Array# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWord64ArrayAsWord64X2# :: () => MutableByteArray# d -> Int# -> Word64X2# -> State# d -> State# d
+ GHC.Exts: writeWord64ArrayAsWord64X4# :: () => MutableByteArray# d -> Int# -> Word64X4# -> State# d -> State# d
+ GHC.Exts: writeWord64ArrayAsWord64X8# :: () => MutableByteArray# d -> Int# -> Word64X8# -> State# d -> State# d
+ GHC.Exts: writeWord64OffAddr# :: () => Addr# -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWord64OffAddrAsWord64X2# :: () => Addr# -> Int# -> Word64X2# -> State# d -> State# d
+ GHC.Exts: writeWord64OffAddrAsWord64X4# :: () => Addr# -> Int# -> Word64X4# -> State# d -> State# d
+ GHC.Exts: writeWord64OffAddrAsWord64X8# :: () => Addr# -> Int# -> Word64X8# -> State# d -> State# d
+ GHC.Exts: writeWord64X2Array# :: () => MutableByteArray# d -> Int# -> Word64X2# -> State# d -> State# d
+ GHC.Exts: writeWord64X2OffAddr# :: () => Addr# -> Int# -> Word64X2# -> State# d -> State# d
+ GHC.Exts: writeWord64X4Array# :: () => MutableByteArray# d -> Int# -> Word64X4# -> State# d -> State# d
+ GHC.Exts: writeWord64X4OffAddr# :: () => Addr# -> Int# -> Word64X4# -> State# d -> State# d
+ GHC.Exts: writeWord64X8Array# :: () => MutableByteArray# d -> Int# -> Word64X8# -> State# d -> State# d
+ GHC.Exts: writeWord64X8OffAddr# :: () => Addr# -> Int# -> Word64X8# -> State# d -> State# d
+ GHC.Exts: writeWord8Array# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWord8ArrayAsWord8X16# :: () => MutableByteArray# d -> Int# -> Word8X16# -> State# d -> State# d
+ GHC.Exts: writeWord8ArrayAsWord8X32# :: () => MutableByteArray# d -> Int# -> Word8X32# -> State# d -> State# d
+ GHC.Exts: writeWord8ArrayAsWord8X64# :: () => MutableByteArray# d -> Int# -> Word8X64# -> State# d -> State# d
+ GHC.Exts: writeWord8OffAddr# :: () => Addr# -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWord8OffAddrAsWord8X16# :: () => Addr# -> Int# -> Word8X16# -> State# d -> State# d
+ GHC.Exts: writeWord8OffAddrAsWord8X32# :: () => Addr# -> Int# -> Word8X32# -> State# d -> State# d
+ GHC.Exts: writeWord8OffAddrAsWord8X64# :: () => Addr# -> Int# -> Word8X64# -> State# d -> State# d
+ GHC.Exts: writeWord8X16Array# :: () => MutableByteArray# d -> Int# -> Word8X16# -> State# d -> State# d
+ GHC.Exts: writeWord8X16OffAddr# :: () => Addr# -> Int# -> Word8X16# -> State# d -> State# d
+ GHC.Exts: writeWord8X32Array# :: () => MutableByteArray# d -> Int# -> Word8X32# -> State# d -> State# d
+ GHC.Exts: writeWord8X32OffAddr# :: () => Addr# -> Int# -> Word8X32# -> State# d -> State# d
+ GHC.Exts: writeWord8X64Array# :: () => MutableByteArray# d -> Int# -> Word8X64# -> State# d -> State# d
+ GHC.Exts: writeWord8X64OffAddr# :: () => Addr# -> Int# -> Word8X64# -> State# d -> State# d
+ GHC.Exts: writeWordArray# :: () => MutableByteArray# d -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: writeWordOffAddr# :: () => Addr# -> Int# -> Word# -> State# d -> State# d
+ GHC.Exts: xor# :: Word# -> Word# -> Word#
+ GHC.Exts: xorI# :: Int# -> Int# -> Int#
+ GHC.Exts: yield# :: State# RealWorld -> State# RealWorld
+ GHC.Generics: instance (GHC.Base.Functor f, GHC.Base.Functor g) => GHC.Base.Functor (f GHC.Generics.:*: g)
+ GHC.Generics: instance (GHC.Base.Functor f, GHC.Base.Functor g) => GHC.Base.Functor (f GHC.Generics.:+: g)
+ GHC.Generics: instance (GHC.Base.Functor f, GHC.Base.Functor g) => GHC.Base.Functor (f GHC.Generics.:.: g)
+ GHC.Generics: instance GHC.Generics.Generic (GHC.Base.NonEmpty a)
+ GHC.Generics: instance GHC.Generics.Generic1 GHC.Base.NonEmpty
+ GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Generics.:*:) f g p)
+ GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Eq (f p), GHC.Classes.Eq (g p)) => GHC.Classes.Eq ((GHC.Generics.:+:) f g p)
+ GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Generics.:*:) f g p)
+ GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Classes.Ord (f p), GHC.Classes.Ord (g p)) => GHC.Classes.Ord ((GHC.Generics.:+:) f g p)
+ GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Read.Read (f p), GHC.Read.Read (g p)) => GHC.Read.Read ((GHC.Generics.:*:) f g p)
+ GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Read.Read (f p), GHC.Read.Read (g p)) => GHC.Read.Read ((GHC.Generics.:+:) f g p)
+ GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Show.Show (f p), GHC.Show.Show (g p)) => GHC.Show.Show ((GHC.Generics.:*:) f g p)
+ GHC.Generics: instance forall k (f :: k -> *) (g :: k -> *) (p :: k). (GHC.Show.Show (f p), GHC.Show.Show (g p)) => GHC.Show.Show ((GHC.Generics.:+:) f g p)
+ GHC.IO.Encoding: argvEncoding :: IO TextEncoding
+ GHC.IO.Handle.Lock: hUnlock :: Handle -> IO ()
+ GHC.OldList: iterate' :: (a -> a) -> a -> [a]
+ GHC.RTS.Flags: [generateCrashDumpFile] :: MiscFlags -> Bool
+ GHC.RTS.Flags: [generateStackTrace] :: MiscFlags -> Bool
+ GHC.RTS.Flags: [installSEHHandlers] :: MiscFlags -> Bool
+ GHC.Stats: [cumulative_par_balanced_copied_bytes] :: RTSStats -> Word64
+ GHC.Stats: [gcdetails_par_balanced_copied_bytes] :: GCDetails -> Word64
+ Numeric: (**) :: Floating a => a -> a -> a
+ Numeric: acos :: Floating a => a -> a
+ Numeric: acosh :: Floating a => a -> a
+ Numeric: asin :: Floating a => a -> a
+ Numeric: asinh :: Floating a => a -> a
+ Numeric: atan :: Floating a => a -> a
+ Numeric: atanh :: Floating a => a -> a
+ Numeric: cos :: Floating a => a -> a
+ Numeric: cosh :: Floating a => a -> a
+ Numeric: exp :: Floating a => a -> a
+ Numeric: log :: Floating a => a -> a
+ Numeric: logBase :: Floating a => a -> a -> a
+ Numeric: showHFloat :: RealFloat a => a -> ShowS
+ Numeric: sin :: Floating a => a -> a
+ Numeric: sinh :: Floating a => a -> a
+ Numeric: sqrt :: Floating a => a -> a
+ Numeric: tan :: Floating a => a -> a
+ Numeric: tanh :: Floating a => a -> a
+ Prelude: (*) :: Num a => a -> a -> a
+ Prelude: (**) :: Floating a => a -> a -> a
+ Prelude: (+) :: Num a => a -> a -> a
+ Prelude: (-) :: Num a => a -> a -> a
+ Prelude: (<>) :: Semigroup a => a -> a -> a
+ Prelude: acos :: Floating a => a -> a
+ Prelude: acosh :: Floating a => a -> a
+ Prelude: asin :: Floating a => a -> a
+ Prelude: asinh :: Floating a => a -> a
+ Prelude: atan :: Floating a => a -> a
+ Prelude: atanh :: Floating a => a -> a
+ Prelude: class Semigroup a
+ Prelude: cos :: Floating a => a -> a
+ Prelude: cosh :: Floating a => a -> a
+ Prelude: exp :: Floating a => a -> a
+ Prelude: log :: Floating a => a -> a
+ Prelude: logBase :: Floating a => a -> a -> a
+ Prelude: maxBound :: Bounded a => a
+ Prelude: minBound :: Bounded a => a
+ Prelude: sin :: Floating a => a -> a
+ Prelude: sinh :: Floating a => a -> a
+ Prelude: sqrt :: Floating a => a -> a
+ Prelude: tan :: Floating a => a -> a
+ Prelude: tanh :: Floating a => a -> a
+ System.Environment.Blank: getArgs :: IO [String]
+ System.Environment.Blank: getEnv :: String -> IO (Maybe String)
+ System.Environment.Blank: getEnvDefault :: String -> String -> IO String
+ System.Environment.Blank: getEnvironment :: IO [(String, String)]
+ System.Environment.Blank: getExecutablePath :: IO FilePath
+ System.Environment.Blank: getProgName :: IO String
+ System.Environment.Blank: setEnv :: String -> String -> Bool -> IO ()
+ System.Environment.Blank: unsetEnv :: String -> IO ()
+ System.Environment.Blank: withArgs :: [String] -> IO a -> IO a
+ System.Environment.Blank: withProgName :: String -> IO a -> IO a
+ Text.Printf: instance (a ~ ()) => Text.Printf.HPrintfType (GHC.Types.IO a)
+ Text.Printf: instance (a ~ ()) => Text.Printf.PrintfType (GHC.Types.IO a)
- Control.Arrow: Kleisli :: (a -> m b) -> Kleisli m a b
+ Control.Arrow: Kleisli :: a -> m b -> Kleisli m a b
- Control.Monad.ST: data RealWorld :: *
+ Control.Monad.ST: data RealWorld
- Control.Monad.ST.Lazy: data RealWorld :: *
+ Control.Monad.ST.Lazy: data RealWorld
- Control.Monad.ST.Lazy.Safe: data RealWorld :: *
+ Control.Monad.ST.Lazy.Safe: data RealWorld
- Control.Monad.ST.Safe: data RealWorld :: *
+ Control.Monad.ST.Safe: data RealWorld
- Data.Bool: data Bool :: *
+ Data.Bool: data Bool
- Data.Char: data Char :: *
+ Data.Char: data Char
- Data.Coerce: class (~R#) k0 k0 a b => Coercible k0 (a :: k0) (b :: k0)
+ Data.Coerce: class a ~R# b => Coercible (a :: k0) (b :: k0)
- Data.Coerce: coerce :: Coercible * a b => a -> b
+ Data.Coerce: coerce :: Coercible a b => a -> b
- Data.Int: data Int :: *
+ Data.Int: data Int
- Data.Kind: data Constraint :: *
+ Data.Kind: data Constraint
- Data.Monoid: (<>) :: Monoid m => m -> m -> m
+ Data.Monoid: (<>) :: Semigroup a => a -> a -> a
- Data.Monoid: Endo :: (a -> a) -> Endo a
+ Data.Monoid: Endo :: a -> a -> Endo a
- Data.Monoid: class Monoid a
+ Data.Monoid: class Semigroup a => Monoid a
- Data.Ord: data Ordering :: *
+ Data.Ord: data Ordering
- Data.Semigroup: (<>) :: (Semigroup a, Monoid a) => a -> a -> a
+ Data.Semigroup: (<>) :: Semigroup a => a -> a -> a
- Data.Semigroup: Endo :: (a -> a) -> Endo a
+ Data.Semigroup: Endo :: a -> a -> Endo a
- Data.Type.Equality: class (~#) k0 k1 a b => (~~) k0 k1 (a :: k0) (b :: k1)
+ Data.Type.Equality: class a ~# b => (~~) (a :: k0) (b :: k1)
- Data.Typeable: data TyCon :: *
+ Data.Typeable: data TyCon
- Data.Word: data Word :: *
+ Data.Word: data Word
- Debug.Trace: traceM :: (Applicative f) => String -> f ()
+ Debug.Trace: traceM :: Applicative f => String -> f ()
- Debug.Trace: traceShow :: (Show a) => a -> b -> b
+ Debug.Trace: traceShow :: Show a => a -> b -> b
- Debug.Trace: traceShowId :: (Show a) => a -> a
+ Debug.Trace: traceShowId :: Show a => a -> a
- GHC.Exts: class (~#) k0 k1 a b => (~~) k0 k1 (a :: k0) (b :: k1)
+ GHC.Exts: class a ~# b => (~~) (a :: k0) (b :: k1)
- GHC.Exts: class (~R#) k0 k0 a b => Coercible k0 (a :: k0) (b :: k0)
+ GHC.Exts: class a ~R# b => Coercible (a :: k0) (b :: k0)
- GHC.Exts: coerce :: Coercible * a b => a -> b
+ GHC.Exts: coerce :: Coercible a b => a -> b
- GHC.Exts: data Char :: *
+ GHC.Exts: data Char
- GHC.Exts: data Constraint :: *
+ GHC.Exts: data Constraint
- GHC.Exts: data Double :: *
+ GHC.Exts: data Double
- GHC.Exts: data Float :: *
+ GHC.Exts: data Float
- GHC.Exts: data Int :: *
+ GHC.Exts: data Int
- GHC.Exts: data RuntimeRep :: *
+ GHC.Exts: data RuntimeRep
- GHC.Exts: data TYPE (a :: RuntimeRep) :: RuntimeRep -> *
+ GHC.Exts: data TYPE (a :: RuntimeRep)
- GHC.Exts: data VecCount :: *
+ GHC.Exts: data VecCount
- GHC.Exts: data VecElem :: *
+ GHC.Exts: data VecElem
- GHC.Exts: data Word :: *
+ GHC.Exts: data Word
- GHC.Exts: oneShot :: () => (a -> b) -> a -> b
+ GHC.Exts: oneShot :: () => a -> b -> a -> b
- GHC.Exts: runRW# :: () => (State# RealWorld -> a) -> a
+ GHC.Exts: runRW# :: () => State# RealWorld -> a -> a
- GHC.IO.Encoding: BufferCodec :: CodeBuffer from to -> (Buffer from -> Buffer to -> IO (Buffer from, Buffer to)) -> IO () -> IO state -> (state -> IO ()) -> BufferCodec from to state
+ GHC.IO.Encoding: BufferCodec :: CodeBuffer from to -> Buffer from -> Buffer to -> IO (Buffer from, Buffer to) -> IO () -> IO state -> state -> IO () -> BufferCodec from to state
- GHC.IO.Encoding.Types: BufferCodec :: CodeBuffer from to -> (Buffer from -> Buffer to -> IO (Buffer from, Buffer to)) -> IO () -> IO state -> (state -> IO ()) -> BufferCodec from to state
+ GHC.IO.Encoding.Types: BufferCodec :: CodeBuffer from to -> Buffer from -> Buffer to -> IO (Buffer from, Buffer to) -> IO () -> IO state -> state -> IO () -> BufferCodec from to state
- GHC.RTS.Flags: MiscFlags :: RtsTime -> Bool -> Bool -> Word -> MiscFlags
+ GHC.RTS.Flags: MiscFlags :: RtsTime -> Bool -> Bool -> Bool -> Bool -> Bool -> Word -> MiscFlags
- GHC.Stats: GCDetails :: Word32 -> Word32 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RtsTime -> RtsTime -> RtsTime -> GCDetails
+ GHC.Stats: GCDetails :: Word32 -> Word32 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RtsTime -> RtsTime -> RtsTime -> GCDetails
- GHC.Stats: RTSStats :: Word32 -> Word32 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RtsTime -> RtsTime -> RtsTime -> RtsTime -> RtsTime -> RtsTime -> GCDetails -> RTSStats
+ GHC.Stats: RTSStats :: Word32 -> Word32 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RtsTime -> RtsTime -> RtsTime -> RtsTime -> RtsTime -> RtsTime -> GCDetails -> RTSStats
- GHC.TypeLits: data Nat :: *
+ GHC.TypeLits: data Nat
- GHC.TypeLits: data Symbol :: *
+ GHC.TypeLits: data Symbol
- GHC.TypeNats: data Nat :: *
+ GHC.TypeNats: data Nat
- Prelude: class Monoid a
+ Prelude: class Semigroup a => Monoid a
- Prelude: data Bool :: *
+ Prelude: data Bool
- Prelude: data Char :: *
+ Prelude: data Char
- Prelude: data Double :: *
+ Prelude: data Double
- Prelude: data Float :: *
+ Prelude: data Float
- Prelude: data IO a :: * -> *
+ Prelude: data IO a
- Prelude: data Int :: *
+ Prelude: data Int
- Prelude: data Integer :: *
+ Prelude: data Integer
- Prelude: data Ordering :: *
+ Prelude: data Ordering
- Prelude: data Word :: *
+ Prelude: data Word
- System.IO: data IO a :: * -> *
+ System.IO: data IO a
- Type.Reflection: data Module :: *
+ Type.Reflection: data Module
- Type.Reflection: data TyCon :: *
+ Type.Reflection: data TyCon
- Type.Reflection: withTypeable :: forall a r. TypeRep a -> (Typeable a => r) -> r
+ Type.Reflection: withTypeable :: forall (a :: k) (r :: TYPE rep). () => TypeRep a -> (Typeable a => r) -> r
- Type.Reflection.Unsafe: data KindRep :: *
+ Type.Reflection.Unsafe: data KindRep
- Type.Reflection.Unsafe: data TyCon :: *
+ Type.Reflection.Unsafe: data TyCon
- Type.Reflection.Unsafe: data TypeLitSort :: *
+ Type.Reflection.Unsafe: data TypeLitSort

Files

Control/Applicative.hs view
@@ -59,7 +59,7 @@  import GHC.Base import GHC.Generics-import GHC.List (repeat, zipWith)+import GHC.List (repeat, zipWith, drop) import GHC.Read (Read) import GHC.Show (Show) @@ -107,7 +107,7 @@  -- | -- > f '<$>' 'ZipList' xs1 '<*>' ... '<*>' 'ZipList' xsN---       = 'ZipList' (zipWithN f xs1 ... xsN)+-- >     = 'ZipList' (zipWithN f xs1 ... xsN) -- -- where @zipWithN@ refers to the @zipWith@ function of the appropriate arity -- (@zipWith@, @zipWith3@, @zipWith4@, ...). For example:@@ -120,6 +120,11 @@ instance Applicative ZipList where     pure x = ZipList (repeat x)     liftA2 f (ZipList xs) (ZipList ys) = ZipList (zipWith f xs ys)++-- | @since 4.11.0.0+instance Alternative ZipList where+   empty = ZipList []+   ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys)  -- extra functions 
Control/Category.hs view
@@ -28,8 +28,13 @@ infixr 9 . infixr 1 >>>, <<< --- | A class for categories.---   id and (.) must form a monoid.+-- | A class for categories. Instances should satisfy the laws+--+-- @+-- f '.' 'id'  =  f  -- (right identity)+-- 'id' '.' f  =  f  -- (left identity)+-- f '.' (g '.' h)  =  (f '.' g) '.' h  -- (associativity)+-- @ class Category cat where     -- | the identity morphism     id :: cat a a
Control/Concurrent.hs view
@@ -117,10 +117,11 @@ import Foreign.StablePtr import Foreign.C.Types -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) import Foreign.C import System.IO import Data.Functor ( void )+import Data.Int ( Int64 ) #else import qualified GHC.Conc #endif@@ -401,7 +402,7 @@ -- 'GHC.Conc.closeFdWith'. threadWaitRead :: Fd -> IO () threadWaitRead fd-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   -- we have no IO manager implementing threadWaitRead on Windows.   -- fdReady does the right thing, but we have to call it in a   -- separate thread, otherwise threadWaitRead won't be interruptible,@@ -426,7 +427,7 @@ -- 'GHC.Conc.closeFdWith'. threadWaitWrite :: Fd -> IO () threadWaitWrite fd-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   | threaded  = withThread (waitFd fd 1)   | otherwise = errorWithoutStackTrace "threadWaitWrite requires -threaded on Windows" #else@@ -441,7 +442,7 @@ -- @since 4.7.0.0 threadWaitReadSTM :: Fd -> IO (STM (), IO ()) threadWaitReadSTM fd-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   | threaded = do v <- newTVarIO Nothing                   mask_ $ void $ forkIO $ do result <- try (waitFd fd 0)                                              atomically (writeTVar v $ Just result)@@ -465,7 +466,7 @@ -- @since 4.7.0.0 threadWaitWriteSTM :: Fd -> IO (STM (), IO ()) threadWaitWriteSTM fd-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   | threaded = do v <- newTVarIO Nothing                   mask_ $ void $ forkIO $ do result <- try (waitFd fd 1)                                              atomically (writeTVar v $ Just result)@@ -481,7 +482,7 @@   = GHC.Conc.threadWaitWriteSTM fd #endif -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool  withThread :: IO a -> IO a@@ -496,13 +497,10 @@ waitFd :: Fd -> CInt -> IO () waitFd fd write = do    throwErrnoIfMinus1_ "fdReady" $-        fdReady (fromIntegral fd) write iNFINITE 0--iNFINITE :: CInt-iNFINITE = 0xFFFFFFFF -- urgh+        fdReady (fromIntegral fd) write (-1) 0  foreign import ccall safe "fdReady"-  fdReady :: CInt -> CInt -> CInt -> CInt -> IO CInt+  fdReady :: CInt -> CInt -> Int64 -> CInt -> IO CInt #endif  -- ---------------------------------------------------------------------------
Control/Concurrent/Chan.hs view
@@ -1,13 +1,12 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE CPP #-}-{-# LANGUAGE StandaloneDeriving #-}  ----------------------------------------------------------------------------- -- | -- Module      :  Control.Concurrent.Chan -- Copyright   :  (c) The University of Glasgow 2001 -- License     :  BSD-style (see the file libraries/base/LICENSE)--- +-- -- Maintainer  :  libraries@haskell.org -- Stability   :  experimental -- Portability :  non-portable (concurrency)@@ -22,7 +21,7 @@ -----------------------------------------------------------------------------  module Control.Concurrent.Chan-  ( +  (           -- * The 'Chan' type         Chan,                   -- abstract @@ -31,8 +30,6 @@         writeChan,         readChan,         dupChan,-        unGetChan,-        isEmptyChan,            -- * Stream interface         getChanContents,@@ -136,24 +133,6 @@    hole       <- readMVar writeVar    newReadVar <- newMVar hole    return (Chan newReadVar writeVar)---- |Put a data item back onto a channel, where it will be the next item read.-unGetChan :: Chan a -> a -> IO ()-unGetChan (Chan readVar _) val = do-   new_read_end <- newEmptyMVar-   modifyMVar_ readVar $ \read_end -> do-     putMVar new_read_end (ChItem val read_end)-     return new_read_end-{-# DEPRECATED unGetChan "if you need this operation, use Control.Concurrent.STM.TChan instead.  See <http://ghc.haskell.org/trac/ghc/ticket/4154> for details" #-} -- deprecated in 7.0---- |Returns 'True' if the supplied 'Chan' is empty.-isEmptyChan :: Chan a -> IO Bool-isEmptyChan (Chan readVar writeVar) = do-   withMVar readVar $ \r -> do-     w <- readMVar writeVar-     let eq = r == w-     eq `seq` return eq-{-# DEPRECATED isEmptyChan "if you need this operation, use Control.Concurrent.STM.TChan instead.  See <http://ghc.haskell.org/trac/ghc/ticket/4154> for details" #-} -- deprecated in 7.0  -- Operators for interfacing with functional streams. 
Control/Concurrent/MVar.hs view
@@ -25,7 +25,7 @@ --      wait and signal. -- -- They were introduced in the paper--- <http://research.microsoft.com/~simonpj/papers/concurrent-haskell.ps.gz "Concurrent Haskell">+-- <https://www.haskell.org/ghc/docs/papers/concurrent-haskell.ps.gz "Concurrent Haskell"> -- by Simon Peyton Jones, Andrew Gordon and Sigbjorn Finne, though -- some details of their implementation have since then changed (in -- particular, a put on a full 'MVar' used to error, but now merely@@ -41,8 +41,8 @@ -- atomic operations such as reading from multiple variables: use 'STM' -- instead. ----- In particular, the "bigger" functions in this module ('readMVar',--- 'swapMVar', 'withMVar', 'modifyMVar_' and 'modifyMVar') are simply+-- In particular, the "bigger" functions in this module ('swapMVar',+-- 'withMVar', 'modifyMVar_' and 'modifyMVar') are simply -- the composition of a 'takeMVar' followed by a 'putMVar' with -- exception safety. -- These only have atomicity guarantees if all other threads
Control/Exception.hs view
@@ -376,7 +376,7 @@ > e <- tryJust (guard . isDoesNotExistError) (readFile f) > let str = either (const "") id e -There are occassions when you really do need to catch any sort of+There are occasions when you really do need to catch any sort of exception. However, in most cases this is just so you can do some cleaning up; you aren't actually interested in the exception itself. For example, if you open a file then you want to close it again,
Control/Exception/Base.hs view
@@ -30,6 +30,7 @@         NonTermination(..),         NestedAtomically(..),         BlockedIndefinitelyOnMVar(..),+        FixIOException (..),         BlockedIndefinitelyOnSTM(..),         AllocationLimitExceeded(..),         CompactionFailed(..),
Control/Monad.hs view
@@ -86,8 +86,47 @@ -- ----------------------------------------------------------------------------- -- Functions mandated by the Prelude --- | @'guard' b@ is @'pure' ()@ if @b@ is 'True',--- and 'empty' if @b@ is 'False'.+-- | Conditional failure of 'Alternative' computations. Defined by+--+-- @+-- guard True  = 'pure' ()+-- guard False = 'empty'+-- @+--+-- ==== __Examples__+--+-- Common uses of 'guard' include conditionally signaling an error in+-- an error monad and conditionally rejecting the current choice in an+-- 'Alternative'-based parser.+--+-- As an example of signaling an error in the error monad 'Maybe',+-- consider a safe division function @safeDiv x y@ that returns+-- 'Nothing' when the denominator @y@ is zero and @'Just' (x \`div\`+-- y)@ otherwise. For example:+--+-- @+-- >>> safeDiv 4 0+-- Nothing+-- >>> safeDiv 4 2+-- Just 2+-- @+--+-- A definition of @safeDiv@ using guards, but not 'guard':+--+-- @+-- safeDiv :: Int -> Int -> Maybe Int+-- safeDiv x y | y /= 0    = Just (x \`div\` y)+--             | otherwise = Nothing+-- @+--+-- A definition of @safeDiv@ using 'guard' and 'Monad' @do@-notation:+--+-- @+-- safeDiv :: Int -> Int -> Maybe Int+-- safeDiv x y = do+--   guard (y /= 0)+--   return (x \`div\` y)+-- @ guard           :: (Alternative f) => Bool -> f () guard True      =  pure () guard False     =  empty@@ -146,15 +185,15 @@ function' are not commutative.  ->       foldM f a1 [x1, x2, ..., xm]--==-->       do->         a2 <- f a1 x1->         a3 <- f a2 x2->         ...->         f am xm+> foldM f a1 [x1, x2, ..., xm]+>+> ==+>+> do+>   a2 <- f a1 x1+>   a3 <- f a2 x2+>   ...+>   f am xm  If right-to-left evaluation is required, the input list should be reversed. @@ -264,19 +303,19 @@   The monad type constructor @m@ is added to function results   (modulo currying) and nowhere else.  So, for example, ->  filter  ::              (a ->   Bool) -> [a] ->   [a]->  filterM :: (Monad m) => (a -> m Bool) -> [a] -> m [a]+> filter  ::              (a ->   Bool) -> [a] ->   [a]+> filterM :: (Monad m) => (a -> m Bool) -> [a] -> m [a]  * A postfix \'@_@\' changes the result type from @(m a)@ to @(m ())@.   Thus, for example: ->  sequence  :: Monad m => [m a] -> m [a]->  sequence_ :: Monad m => [m a] -> m ()+> sequence  :: Monad m => [m a] -> m [a]+> sequence_ :: Monad m => [m a] -> m ()  * A prefix \'@m@\' generalizes an existing function to a monadic form.   Thus, for example: ->  sum  :: Num a       => [a]   -> a->  msum :: MonadPlus m => [m a] -> m a+> filter  ::                (a -> Bool) -> [a] -> [a]+> mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a  -}
Control/Monad/Fix.hs view
@@ -29,7 +29,7 @@ import Data.Maybe import Data.Monoid ( Dual(..), Sum(..), Product(..)                    , First(..), Last(..), Alt(..) )-import GHC.Base ( Monad, errorWithoutStackTrace, (.) )+import GHC.Base ( Monad, NonEmpty(..), errorWithoutStackTrace, (.) ) import GHC.Generics import GHC.List ( head, tail ) import GHC.ST@@ -73,6 +73,14 @@     mfix f = case fix (f . head) of                []    -> []                (x:_) -> x : mfix (tail . f)++-- | @since 4.9.0.0+instance MonadFix NonEmpty where+  mfix f = case fix (f . neHead) of+             ~(x :| _) -> x :| mfix (neTail . f)+    where+      neHead ~(a :| _) = a+      neTail ~(_ :| as) = as  -- | @since 2.01 instance MonadFix IO where
Control/Monad/ST.hs view
@@ -16,7 +16,7 @@ -- -- References (variables) that can be used within the @ST@ monad are -- provided by "Data.STRef", and arrays are provided by--- "Data.Array.ST".+-- [Data.Array.ST](https://hackage.haskell.org/package/array/docs/Data-Array-ST.html).  ----------------------------------------------------------------------------- 
Control/Monad/ST/Lazy/Imp.hs view
@@ -51,7 +51,7 @@ -- by @s@, and returns a value of type @a@. -- The @s@ parameter is either ----- * an unstantiated type variable (inside invocations of 'runST'), or+-- * an uninstantiated type variable (inside invocations of 'runST'), or -- -- * 'RealWorld' (inside invocations of 'stToIO'). --
Control/Monad/Zip.hs view
@@ -22,6 +22,7 @@ import Data.Functor.Identity import Data.Monoid import Data.Proxy+import qualified Data.List.NonEmpty as NE import GHC.Generics  -- | `MonadZip` type class. Minimal definition: `mzip` or `mzipWith`@@ -58,6 +59,12 @@     mzip     = zip     mzipWith = zipWith     munzip   = unzip++-- | @since 4.9.0.0+instance MonadZip NE.NonEmpty where+  mzip     = NE.zip+  mzipWith = NE.zipWith+  munzip   = NE.unzip  -- | @since 4.8.0.0 instance MonadZip Identity where
Data/Bifoldable.hs view
@@ -117,7 +117,7 @@   bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c   bifoldr f g z t = appEndo (bifoldMap (Endo #. f) (Endo #. g) t) z -  -- | Combines the elments of a structure in a left associative manner. Given+  -- | Combines the elements of a structure in a left associative manner. Given   -- a hypothetical function @toEitherList :: p a b -> [Either a b]@ yielding a   -- list of all elements of a structure in order, the following would hold:   --
Data/Bifunctor.hs view
@@ -20,7 +20,15 @@ import Control.Applicative  ( Const(..) ) import GHC.Generics ( K1(..) ) --- | Formally, the class 'Bifunctor' represents a bifunctor+-- | A bifunctor is a type constructor that takes+-- two type arguments and is a functor in /both/ arguments. That+-- is, unlike with 'Functor', a type constructor such as 'Either'+-- does not need to be partially applied for a 'Bifunctor'+-- instance, and the methods in this class permit mapping+-- functions over the 'Left' value or the 'Right' value,+-- or both at the same time.+--+-- Formally, the class 'Bifunctor' represents a bifunctor -- from @Hask@ -> @Hask@. -- -- Intuitively it is a bifunctor where both the first and second@@ -59,20 +67,47 @@     -- | Map over both arguments at the same time.     --     -- @'bimap' f g ≡ 'first' f '.' 'second' g@+    --+    -- ==== __Examples__+    -- >>> bimap toUpper (+1) ('j', 3)+    -- ('J',4)+    --+    -- >>> bimap toUpper (+1) (Left 'j')+    -- Left 'J'+    --+    -- >>> bimap toUpper (+1) (Right 3)+    -- Right 4     bimap :: (a -> b) -> (c -> d) -> p a c -> p b d     bimap f g = first f . second g +     -- | Map covariantly over the first argument.     --     -- @'first' f ≡ 'bimap' f 'id'@+    --+    -- ==== __Examples__+    -- >>> first toUpper ('j', 3)+    -- ('J',3)+    --+    -- >>> first toUpper (Left 'j')+    -- Left 'J'     first :: (a -> b) -> p a c -> p b c     first f = bimap f id +     -- | Map covariantly over the second argument.     --     -- @'second' ≡ 'bimap' 'id'@+    --+    -- ==== __Examples__+    -- >>> second (+1) ('j', 3)+    -- ('j',4)+    --+    -- >>> second (+1) (Right 3)+    -- Right 4     second :: (b -> c) -> p a b -> p a c     second = bimap id+   -- | @since 4.8.0.0
Data/Bits.hs view
@@ -57,17 +57,13 @@  #include "MachDeps.h" -#ifdef MIN_VERSION_integer_gmp-# define HAVE_INTEGER_GMP1 MIN_VERSION_integer_gmp(1,0,0)-#endif- import Data.Maybe import GHC.Enum import GHC.Num import GHC.Base import GHC.Real -#if HAVE_INTEGER_GMP1+#if defined(MIN_VERSION_integer_gmp) import GHC.Integer.GMP.Internals (bitInteger, popCountInteger) #endif @@ -245,7 +241,7 @@     x `shiftR`  i = x `shift`  (-i)      {-| Shift the first argument right by the specified number of bits, which-        must be non-negative an smaller than the number of bits in the type.+        must be non-negative and smaller than the number of bits in the type.          Right shifts perform sign extension on signed number types;         i.e. they fill the top bits with 1 if the @x@ is negative@@ -526,7 +522,7 @@    testBit x (I# i) = testBitInteger x i    zeroBits   = 0 -#if HAVE_INTEGER_GMP1+#if defined(MIN_VERSION_integer_gmp)    bit (I# i#) = bitInteger i#    popCount x  = I# (popCountInteger x) #else
Data/Char.hs view
@@ -132,6 +132,8 @@ -- True -- >>> isLetter 'A' -- True+-- >>> isLetter 'λ'+-- True -- >>> isLetter '0' -- False -- >>> isLetter '%'
Data/Complex.hs view
@@ -197,7 +197,8 @@                       where (x':+y') = log (((1-y):+x) / sqrt (1+z*z))      asinh z        =  log (z + sqrt (1+z*z))-    acosh z        =  log (z + (z+1) * sqrt ((z-1)/(z+1)))+    -- Take care to allow (-1)::Complex, fixing #8532+    acosh z        =  log (z + (sqrt $ z+1) * (sqrt $ z-1))     atanh z        =  0.5 * log ((1.0+z) / (1.0-z))      log1p x@(a :+ b)
Data/Data.hs view
@@ -140,6 +140,8 @@ --import GHC.IOBase            -- So we can give Data instance for IO, Handle import GHC.Ptr               -- So we can give Data instance for Ptr import GHC.ForeignPtr        -- So we can give Data instance for ForeignPtr+import Foreign.Ptr (IntPtr(..), WordPtr(..))+                             -- So we can give Data instance for IntPtr and WordPtr --import GHC.Stable            -- So we can give Data instance for StablePtr --import GHC.ST                -- So we can give Data instance for ST --import GHC.Conc              -- So we can give Data instance for MVar & Co.@@ -277,22 +279,34 @@ ------------------------------------------------------------------------------    -- | Mediate types and unary type constructors.-  -- In 'Data' instances of the form @T a@, 'dataCast1' should be defined-  -- as 'gcast1'.   --+  -- In 'Data' instances of the form+  --+  -- @+  --     instance (Data a, ...) => Data (T a)+  -- @+  --+  -- 'dataCast1' should be defined as 'gcast1'.+  --   -- The default definition is @'const' 'Nothing'@, which is appropriate-  -- for non-unary type constructors.+  -- for instances of other forms.   dataCast1 :: Typeable t             => (forall d. Data d => c (t d))             -> Maybe (c a)   dataCast1 _ = Nothing    -- | Mediate types and binary type constructors.-  -- In 'Data' instances of the form @T a b@, 'dataCast2' should be-  -- defined as 'gcast2'.   --+  -- In 'Data' instances of the form+  --+  -- @+  --     instance (Data a, Data b, ...) => Data (T a b)+  -- @+  --+  -- 'dataCast2' should be defined as 'gcast2'.+  --   -- The default definition is @'const' 'Nothing'@, which is appropriate-  -- for non-binary type constructors.+  -- for instances of other forms.   dataCast2 :: Typeable t             => (forall d e. (Data d, Data e) => c (t d e))             -> Maybe (c a)@@ -779,7 +793,7 @@                     FloatRep -> mkPrimCon dt (show f) (FloatConstr (toRational f))                     _ -> errorWithoutStackTrace $ "Data.Data.mkRealConstr is not supported for "                                  ++ dataTypeName dt ++-                                 ", as it is not an Real data type."+                                 ", as it is not a Real data type."  -- | Makes a constructor for 'Char'. mkCharConstr :: DataType -> Char -> Constr@@ -1137,6 +1151,9 @@  ------------------------------------------------------------------------------ +-- | @since 4.9.0.0+deriving instance Data a => Data (NonEmpty a)+ -- | @since 4.0.0.0 deriving instance Data a => Data (Maybe a) @@ -1188,6 +1205,12 @@   gunfold _ _  = errorWithoutStackTrace "Data.Data.gunfold(ForeignPtr)"   dataTypeOf _ = mkNoRepType "GHC.ForeignPtr.ForeignPtr"   dataCast1 x  = gcast1 x++-- | @since 4.11.0.0+deriving instance Data IntPtr++-- | @since 4.11.0.0+deriving instance Data WordPtr  ------------------------------------------------------------------------------ -- The Data instance for Array preserves data abstraction at the cost of
Data/Either.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE StandaloneDeriving #-}@@ -33,8 +34,6 @@ import GHC.Show import GHC.Read -import Data.Type.Equality- -- $setup -- Allow the use of some Prelude functions in doctests. -- >>> import Prelude ( (+), (*), length, putStrLn )@@ -131,6 +130,17 @@     fmap _ (Left x) = Left x     fmap f (Right y) = Right (f y) +-- | @since 4.9.0.0+instance Semigroup (Either a b) where+    Left _ <> b = b+    a      <> _ = a+#if !defined(__HADDOCK_VERSION__)+    -- workaround https://github.com/haskell/haddock/issues/680+    stimes n x+      | n <= 0 = errorWithoutStackTrace "stimes: positive multiplier expected"+      | otherwise = x+#endif+ -- | @since 3.0 instance Applicative (Either e) where     pure          = Right@@ -317,13 +327,6 @@ fromRight :: b -> Either a b -> b fromRight _ (Right b) = b fromRight b _         = b---- instance for the == Boolean type-level equality operator-type family EqEither a b where-  EqEither ('Left x)  ('Left y)  = x == y-  EqEither ('Right x) ('Right y) = x == y-  EqEither a          b          = 'False-type instance a == b = EqEither a b  {- {--------------------------------------------------------------------
Data/Foldable.hs view
@@ -99,6 +99,8 @@ -- -- > fold = foldMap id --+-- > length = getSum . foldMap (Sum . const  1)+-- -- @sum@, @product@, @maximum@, and @minimum@ should all be essentially -- equivalent to @foldMap@ forms, such as --@@ -294,6 +296,16 @@     sum     = List.sum     toList  = id +-- | @since 4.9.0.0+instance Foldable NonEmpty where+  foldr f z ~(a :| as) = f a (List.foldr f z as)+  foldl f z ~(a :| as) = List.foldl f (f z a) as+  foldl1 f ~(a :| as) = List.foldl f a as+  foldMap f ~(a :| as) = f a `mappend` foldMap f as+  fold ~(m :| ms) = m `mappend` fold ms+  length (_ :| as) = 1 + List.length as+  toList ~(a :| as) = a : as+ -- | @since 4.7.0.0 instance Foldable (Either a) where     foldMap _ (Left _) = mempty@@ -506,6 +518,9 @@ sequence_ = foldr (>>) (return ())  -- | The sum of a collection of actions, generalizing 'concat'.+--+-- asum [Just "Hello", Nothing, Just "World"]+-- Just "Hello" asum :: (Foldable t, Alternative f) => t (f a) -> f a {-# INLINE asum #-} asum = foldr (<|>) empty
Data/Function.hs view
@@ -32,13 +32,28 @@  -- | @'fix' f@ is the least fixed point of the function @f@, -- i.e. the least defined @x@ such that @f x = x@.+--+-- For example, we can write the factorial function using direct recursion as+--+-- >>> let fac n = if n <= 1 then 1 else n * fac (n-1) in fac 5+-- 120+--+-- This uses the fact that Haskell’s @let@ introduces recursive bindings. We can+-- rewrite this definition using 'fix',+--+-- >>> fix (\rec n -> if n <= 1 then 1 else n * rec (n-1)) 5+-- 120+--+-- Instead of making a recursive call, we introduce a dummy parameter @rec@;+-- when used within 'fix', this parameter then refers to 'fix'' argument, hence+-- the recursion is reintroduced. fix :: (a -> a) -> a fix f = let x = f x in x --- | @(*) \`on\` f = \\x y -> f x * f y@.+-- | @((==) \`on\` f) x y = f x == f y@ -- -- Typical usage: @'Data.List.sortBy' ('compare' \`on\` 'fst')@.---+ -- Algebraic properties: -- -- * @(*) \`on\` 'id' = (*)@ (if @(*) &#x2209; {&#x22a5;, 'const' &#x22a5;}@)@@ -95,6 +110,12 @@ -- convenience.  Its precedence is one higher than that of the forward -- application operator '$', which allows '&' to be nested in '$'. --+-- >>> 5 & (+1) & show+-- "6"+-- -- @since 4.8.0.0 (&) :: a -> (a -> b) -> b x & f = f x++-- $setup+-- >>> import Prelude
Data/Functor.hs view
@@ -20,6 +20,7 @@       (<$),       ($>),       (<$>),+      (<&>),       void,     ) where @@ -73,6 +74,31 @@ (<$>) = fmap  infixl 4 $>++-- | Flipped version of '<$>'.+--+-- @+-- ('<&>') = 'flip' 'fmap'+-- @+--+-- @since 4.11.0.0+--+-- ==== __Examples__+-- Apply @(+1)@ to a list, a 'Data.Maybe.Just' and a 'Data.Either.Right':+--+-- >>> Just 2 <&> (+1)+-- Just 3+--+-- >>> [1,2,3] <&> (+1)+-- [2,3,4]+--+-- >>> Right 3 <&> (+1)+-- Right 4+--+(<&>) :: Functor f => f a -> (a -> b) -> f b+as <&> f = f <$> as++infixl 1 <&>  -- | Flipped version of '<$'. --
Data/Functor/Classes.hs view
@@ -68,6 +68,7 @@  import Data.Functor.Identity (Identity(Identity)) import Data.Proxy (Proxy(Proxy))+import Data.List.NonEmpty (NonEmpty(..)) import Data.Monoid (mappend)  import GHC.Read (expectP, list, paren)@@ -451,6 +452,27 @@ -- | @since 4.9.0.0 instance Show1 [] where     liftShowsPrec _ sl _ = sl++-- | @since 4.10.0.0+instance Eq1 NonEmpty where+  liftEq eq (a :| as) (b :| bs) = eq a b && liftEq eq as bs++-- | @since 4.10.0.0+instance Ord1 NonEmpty where+  liftCompare cmp (a :| as) (b :| bs) = cmp a b `mappend` liftCompare cmp as bs++-- | @since 4.10.0.0+instance Read1 NonEmpty where+  liftReadsPrec rdP rdL p s = readParen (p > 5) (\s' -> do+    (a, s'') <- rdP 6 s'+    (":|", s''') <- lex s''+    (as, s'''') <- rdL s'''+    return (a :| as, s'''')) s++-- | @since 4.10.0.0+instance Show1 NonEmpty where+  liftShowsPrec shwP shwL p (a :| as) = showParen (p > 5) $+    shwP 6 a . showString " :| " . shwL as  -- | @since 4.9.0.0 instance Eq2 (,) where
Data/Functor/Const.hs view
@@ -38,8 +38,8 @@ -- | The 'Const' functor. newtype Const a b = Const { getConst :: a }     deriving ( Bits, Bounded, Enum, Eq, FiniteBits, Floating, Fractional-             , Generic, Generic1, Integral, Ix, Monoid, Num, Ord, Real-             , RealFrac, RealFloat , Storable)+             , Generic, Generic1, Integral, Ix, Semigroup, Monoid, Num, Ord+             , Real, RealFrac, RealFloat, Storable)  -- | This instance would be equivalent to the derived instances of the -- 'Const' newtype if the 'runConst' field were removed
Data/Functor/Identity.hs view
@@ -43,7 +43,7 @@ import Foreign.Storable (Storable) import GHC.Arr (Ix) import GHC.Base ( Applicative(..), Eq(..), Functor(..), Monad(..)-                , Monoid, Ord(..), ($), (.) )+                , Semigroup, Monoid, Ord(..), ($), (.) ) import GHC.Enum (Bounded, Enum) import GHC.Float (Floating, RealFloat) import GHC.Generics (Generic, Generic1)@@ -58,7 +58,7 @@ -- @since 4.8.0.0 newtype Identity a = Identity { runIdentity :: a }     deriving ( Bits, Bounded, Enum, Eq, FiniteBits, Floating, Fractional-             , Generic, Generic1, Integral, Ix, Monoid, Num, Ord+             , Generic, Generic1, Integral, Ix, Semigroup, Monoid, Num, Ord              , Real, RealFrac, RealFloat, Storable)  -- | This instance would be equivalent to the derived instances of the
Data/Functor/Utils.hs view
@@ -11,7 +11,7 @@  import Data.Coerce (Coercible, coerce) import GHC.Base ( Applicative(..), Functor(..), Maybe(..), Monoid(..), Ord(..)-                , ($), otherwise )+                , Semigroup(..), ($), otherwise )  -- We don't expose Max and Min because, as Edward Kmett pointed out to me, -- there are two reasonable ways to define them. One way is to use Maybe, as we@@ -22,27 +22,31 @@ newtype Max a = Max {getMax :: Maybe a} newtype Min a = Min {getMin :: Maybe a} +-- | @since 4.11.0.0+instance Ord a => Semigroup (Max a) where+    {-# INLINE (<>) #-}+    m <> Max Nothing = m+    Max Nothing <> n = n+    (Max m@(Just x)) <> (Max n@(Just y))+      | x >= y    = Max m+      | otherwise = Max n+ -- | @since 4.8.0.0 instance Ord a => Monoid (Max a) where-  mempty = Max Nothing+    mempty = Max Nothing -  {-# INLINE mappend #-}-  m `mappend` Max Nothing = m-  Max Nothing `mappend` n = n-  (Max m@(Just x)) `mappend` (Max n@(Just y))-    | x >= y    = Max m-    | otherwise = Max n+-- | @since 4.11.0.0+instance Ord a => Semigroup (Min a) where+    {-# INLINE (<>) #-}+    m <> Min Nothing = m+    Min Nothing <> n = n+    (Min m@(Just x)) <> (Min n@(Just y))+      | x <= y    = Min m+      | otherwise = Min n  -- | @since 4.8.0.0 instance Ord a => Monoid (Min a) where-  mempty = Min Nothing--  {-# INLINE mappend #-}-  m `mappend` Min Nothing = m-  Min Nothing `mappend` n = n-  (Min m@(Just x)) `mappend` (Min n@(Just y))-    | x <= y    = Min m-    | otherwise = Min n+    mempty = Min Nothing  -- left-to-right state transformer newtype StateL s a = StateL { runStateL :: s -> (s, a) }
Data/List.hs view
@@ -76,6 +76,7 @@     -- ** Infinite lists    , iterate+   , iterate'    , repeat    , replicate    , cycle
Data/List/NonEmpty.hs view
@@ -102,65 +102,14 @@ import qualified Prelude  import           Control.Applicative (Applicative (..), Alternative (many))-import           Control.Monad       (ap, liftM2)-import           Control.Monad.Fix-import           Control.Monad.Zip   (MonadZip(..))-import           Data.Data           (Data) import           Data.Foldable       hiding (length, toList) import qualified Data.Foldable       as Foldable import           Data.Function       (on)-import           Data.Functor.Classes (Eq1(..), Ord1(..), Read1(..), Show1(..)) import qualified Data.List           as List-import           Data.Monoid         ((<>)) import           Data.Ord            (comparing)-import qualified GHC.Exts            as Exts (IsList(..))-import           GHC.Generics        (Generic, Generic1)--infixr 5 :|, <|---- | Non-empty (and non-strict) list type.------ @since 4.9.0.0-data NonEmpty a = a :| [a]-  deriving ( Eq, Ord, Show, Read, Data, Generic, Generic1 )---- | @since 4.10.0.0-instance Eq1 NonEmpty where-  liftEq eq (a :| as) (b :| bs) = eq a b && liftEq eq as bs---- | @since 4.10.0.0-instance Ord1 NonEmpty where-  liftCompare cmp (a :| as) (b :| bs) = cmp a b <> liftCompare cmp as bs---- | @since 4.10.0.0-instance Read1 NonEmpty where-  liftReadsPrec rdP rdL p s = readParen (p > 5) (\s' -> do-    (a, s'') <- rdP 6 s'-    (":|", s''') <- lex s''-    (as, s'''') <- rdL s'''-    return (a :| as, s'''')) s---- | @since 4.10.0.0-instance Show1 NonEmpty where-  liftShowsPrec shwP shwL p (a :| as) = showParen (p > 5) $-    shwP 6 a . showString " :| " . shwL as---- | @since 4.9.0.0-instance Exts.IsList (NonEmpty a) where-  type Item (NonEmpty a) = a-  fromList               = fromList-  toList                 = toList---- | @since 4.9.0.0-instance MonadFix NonEmpty where-  mfix f = case fix (f . head) of-             ~(x :| _) -> x :| mfix (tail . f)+import           GHC.Base            (NonEmpty(..)) --- | @since 4.9.0.0-instance MonadZip NonEmpty where-  mzip     = zip-  mzipWith = zipWith-  munzip   = unzip+infixr 5 <|  -- | Number of elements in 'NonEmpty' list. length :: NonEmpty a -> Int@@ -203,37 +152,6 @@     go c = case f c of       (d, me) -> d : maybe [] go me --- | @since 4.9.0.0-instance Functor NonEmpty where-  fmap f ~(a :| as) = f a :| fmap f as-  b <$ ~(_ :| as)   = b   :| (b <$ as)---- | @since 4.9.0.0-instance Applicative NonEmpty where-  pure a = a :| []-  (<*>) = ap-  liftA2 = liftM2---- | @since 4.9.0.0-instance Monad NonEmpty where-  ~(a :| as) >>= f = b :| (bs ++ bs')-    where b :| bs = f a-          bs' = as >>= toList . f---- | @since 4.9.0.0-instance Traversable NonEmpty where-  traverse f ~(a :| as) = liftA2 (:|) (f a) (traverse f as)---- | @since 4.9.0.0-instance Foldable NonEmpty where-  foldr f z ~(a :| as) = f a (foldr f z as)-  foldl f z ~(a :| as) = foldl f (f z a) as-  foldl1 f ~(a :| as) = foldl f a as-  foldMap f ~(a :| as) = f a `mappend` foldMap f as-  fold ~(m :| ms) = m `mappend` fold ms-  length = length-  toList = toList- -- | Extract the first element of the stream. head :: NonEmpty a -> a head ~(a :| _) = a@@ -477,6 +395,7 @@   | n == 0 = x   | n > 0  = xs List.!! (n - 1)   | otherwise = errorWithoutStackTrace "NonEmpty.!! negative argument"+infixl 9 !!  -- | The 'zip' function takes two streams and returns a stream of -- corresponding pairs.
Data/Maybe.hs view
@@ -228,9 +228,12 @@ -- >>> maybeToList $ listToMaybe [1,2,3] -- [1] ---listToMaybe           :: [a] -> Maybe a-listToMaybe []        =  Nothing-listToMaybe (a:_)     =  Just a+listToMaybe :: [a] -> Maybe a+listToMaybe = foldr (const . Just) Nothing+{-# INLINE listToMaybe #-}+-- We define listToMaybe using foldr so that it can fuse via the foldr/build+-- rule. See #14387+  -- | The 'catMaybes' function takes a list of 'Maybe's and returns -- a list of all the 'Just' values.
Data/Monoid.hs view
@@ -43,123 +43,11 @@  -- Push down the module in the dependency hierarchy. import GHC.Base hiding (Any)-import GHC.Enum-import GHC.Num import GHC.Read import GHC.Show import GHC.Generics -{---- just for testing-import Data.Maybe-import Test.QuickCheck--- -}--infixr 6 <>---- | An infix synonym for 'mappend'.------ @since 4.5.0.0-(<>) :: Monoid m => m -> m -> m-(<>) = mappend-{-# INLINE (<>) #-}---- Monoid instances.---- | The dual of a 'Monoid', obtained by swapping the arguments of 'mappend'.-newtype Dual a = Dual { getDual :: a }-        deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1)---- | @since 2.01-instance Monoid a => Monoid (Dual a) where-        mempty = Dual mempty-        Dual x `mappend` Dual y = Dual (y `mappend` x)---- | @since 4.8.0.0-instance Functor Dual where-    fmap     = coerce---- | @since 4.8.0.0-instance Applicative Dual where-    pure     = Dual-    (<*>)    = coerce---- | @since 4.8.0.0-instance Monad Dual where-    m >>= k  = k (getDual m)---- | The monoid of endomorphisms under composition.-newtype Endo a = Endo { appEndo :: a -> a }-               deriving (Generic)---- | @since 2.01-instance Monoid (Endo a) where-        mempty = Endo id-        Endo f `mappend` Endo g = Endo (f . g)---- | Boolean monoid under conjunction ('&&').-newtype All = All { getAll :: Bool }-        deriving (Eq, Ord, Read, Show, Bounded, Generic)---- | @since 2.01-instance Monoid All where-        mempty = All True-        All x `mappend` All y = All (x && y)---- | Boolean monoid under disjunction ('||').-newtype Any = Any { getAny :: Bool }-        deriving (Eq, Ord, Read, Show, Bounded, Generic)---- | @since 2.01-instance Monoid Any where-        mempty = Any False-        Any x `mappend` Any y = Any (x || y)---- | Monoid under addition.-newtype Sum a = Sum { getSum :: a }-        deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1, Num)---- | @since 2.01-instance Num a => Monoid (Sum a) where-        mempty = Sum 0-        mappend = coerce ((+) :: a -> a -> a)---        Sum x `mappend` Sum y = Sum (x + y)---- | @since 4.8.0.0-instance Functor Sum where-    fmap     = coerce---- | @since 4.8.0.0-instance Applicative Sum where-    pure     = Sum-    (<*>)    = coerce---- | @since 4.8.0.0-instance Monad Sum where-    m >>= k  = k (getSum m)---- | Monoid under multiplication.-newtype Product a = Product { getProduct :: a }-        deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1, Num)---- | @since 2.01-instance Num a => Monoid (Product a) where-        mempty = Product 1-        mappend = coerce ((*) :: a -> a -> a)---        Product x `mappend` Product y = Product (x * y)---- | @since 4.8.0.0-instance Functor Product where-    fmap     = coerce---- | @since 4.8.0.0-instance Applicative Product where-    pure     = Product-    (<*>)    = coerce---- | @since 4.8.0.0-instance Monad Product where-    m >>= k  = k (getProduct m)+import Data.Semigroup.Internal  -- $MaybeExamples -- To implement @find@ or @findLast@ on any 'Foldable':@@ -197,41 +85,45 @@ -- -- @'First' a@ is isomorphic to @'Alt' 'Maybe' a@, but precedes it -- historically.+--+-- >>> getFirst (First (Just "hello") <> First Nothing <> First (Just "world"))+-- Just "hello" newtype First a = First { getFirst :: Maybe a }         deriving (Eq, Ord, Read, Show, Generic, Generic1,                   Functor, Applicative, Monad) +-- | @since 4.9.0.0+instance Semigroup (First a) where+        First Nothing <> b = b+        a             <> _ = a+        stimes = stimesIdempotentMonoid+ -- | @since 2.01 instance Monoid (First a) where         mempty = First Nothing-        First Nothing `mappend` r = r-        l `mappend` _             = l  -- | Maybe monoid returning the rightmost non-Nothing value. -- -- @'Last' a@ is isomorphic to @'Dual' ('First' a)@, and thus to -- @'Dual' ('Alt' 'Maybe' a)@+--+-- >>> getLast (Last (Just "hello") <> Last Nothing <> Last (Just "world"))+-- Just "world" newtype Last a = Last { getLast :: Maybe a }         deriving (Eq, Ord, Read, Show, Generic, Generic1,                   Functor, Applicative, Monad) +-- | @since 4.9.0.0+instance Semigroup (Last a) where+        a <> Last Nothing = a+        _ <> b                   = b+        stimes = stimesIdempotentMonoid+ -- | @since 2.01 instance Monoid (Last a) where         mempty = Last Nothing-        l `mappend` Last Nothing = l-        _ `mappend` r            = r --- | Monoid under '<|>'.------ @since 4.8.0.0-newtype Alt f a = Alt {getAlt :: f a}-  deriving (Generic, Generic1, Read, Show, Eq, Ord, Num, Enum,-            Monad, MonadPlus, Applicative, Alternative, Functor) --- | @since 4.8.0.0-instance Alternative f => Monoid (Alt f a) where-        mempty = Alt empty-        mappend = coerce ((<|>) :: f a -> f a -> f a)  {- {--------------------------------------------------------------------@@ -253,3 +145,6 @@         where listLastToMaybe [] = Nothing               listLastToMaybe lst = Just (last lst) -- -}++-- $setup+-- >>> import Prelude
Data/OldList.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE Trustworthy #-}-{-# LANGUAGE CPP, NoImplicitPrelude, ScopedTypeVariables, MagicHash #-}+{-# LANGUAGE CPP, NoImplicitPrelude, ScopedTypeVariables,+             MagicHash, BangPatterns #-}  ----------------------------------------------------------------------------- -- |@@ -76,6 +77,7 @@     -- ** Infinite lists    , iterate+   , iterate'    , repeat    , replicate    , cycle@@ -227,8 +229,12 @@ -- | The 'dropWhileEnd' function drops the largest suffix of a list -- in which the given predicate holds for all elements.  For example: ----- > dropWhileEnd isSpace "foo\n" == "foo"--- > dropWhileEnd isSpace "foo bar" == "foo bar"+-- >>> dropWhileEnd isSpace "foo\n"+-- "foo"+--+-- >>> dropWhileEnd isSpace "foo bar"+-- "foo bar"+-- -- > dropWhileEnd isSpace ("foo\n" ++ undefined) == "foo" ++ undefined -- -- @since 4.5.0.0@@ -239,10 +245,17 @@ -- It returns 'Nothing' if the list did not start with the prefix -- given, or 'Just' the list after the prefix, if it does. ----- > stripPrefix "foo" "foobar" == Just "bar"--- > stripPrefix "foo" "foo" == Just ""--- > stripPrefix "foo" "barfoo" == Nothing--- > stripPrefix "foo" "barfoobaz" == Nothing+-- >>> stripPrefix "foo" "foobar"+-- Just "bar"+--+-- >>> stripPrefix "foo" "foo"+-- Just ""+--+-- >>> stripPrefix "foo" "barfoo"+-- Nothing+--+-- >>> stripPrefix "foo" "barfoobaz"+-- Nothing stripPrefix :: Eq a => [a] -> [a] -> Maybe [a] stripPrefix [] ys = Just ys stripPrefix (x:xs) (y:ys)@@ -252,30 +265,48 @@ -- | The 'elemIndex' function returns the index of the first element -- in the given list which is equal (by '==') to the query element, -- or 'Nothing' if there is no such element.+--+-- >>> elemIndex 4 [0..]+-- Just 4 elemIndex       :: Eq a => a -> [a] -> Maybe Int elemIndex x     = findIndex (x==)  -- | The 'elemIndices' function extends 'elemIndex', by returning the -- indices of all elements equal to the query element, in ascending order.+--+-- >>> elemIndices 'o' "Hello World"+-- [4,7] elemIndices     :: Eq a => a -> [a] -> [Int] elemIndices x   = findIndices (x==)  -- | The 'find' function takes a predicate and a list and returns the -- first element in the list matching the predicate, or 'Nothing' if -- there is no such element.+--+-- >>> find (> 4) [1..]+-- Just 5+--+-- >>> find (< 0) [1..10]+-- Nothing find            :: (a -> Bool) -> [a] -> Maybe a find p          = listToMaybe . filter p  -- | The 'findIndex' function takes a predicate and a list and returns -- the index of the first element in the list satisfying the predicate, -- or 'Nothing' if there is no such element.+--+-- >>> findIndex isSpace "Hello World!"+-- Just 5 findIndex       :: (a -> Bool) -> [a] -> Maybe Int findIndex p     = listToMaybe . findIndices p  -- | The 'findIndices' function extends 'findIndex', by returning the -- indices of all elements satisfying the predicate, in ascending order.+--+-- >>> findIndices (`elem` "aeiou") "Hello World!"+-- [1,4,7] findIndices      :: (a -> Bool) -> [a] -> [Int]-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) findIndices p xs = [ i | (x,i) <- zip xs [0..], p x] #else -- Efficient definition, adapted from Data.Sequence@@ -288,6 +319,12 @@  -- | The 'isPrefixOf' function takes two lists and returns 'True' -- iff the first list is a prefix of the second.+--+-- >>> "Hello" `isPrefixOf` "Hello World!"+-- True+--+-- >>> "Hello" `isPrefixOf` "Wello Horld!"+-- False isPrefixOf              :: (Eq a) => [a] -> [a] -> Bool isPrefixOf [] _         =  True isPrefixOf _  []        =  False@@ -296,6 +333,12 @@ -- | The 'isSuffixOf' function takes two lists and returns 'True' iff -- the first list is a suffix of the second. The second list must be -- finite.+--+-- >>> "ld!" `isSuffixOf` "Hello World!"+-- True+--+-- >>> "World" `isSuffixOf` "Hello World!"+-- False isSuffixOf              :: (Eq a) => [a] -> [a] -> Bool ns `isSuffixOf` hs      = maybe False id $ do       delta <- dropLengthMaybe ns hs@@ -310,6 +353,12 @@ -- entirety.  dropLength is also generally faster than (drop . length) -- Both this and dropLengthMaybe could be written as folds over their first -- arguments, but this reduces clarity with no benefit to isSuffixOf.+--+-- >>> dropLength "Hello" "Holla world"+-- " world"+--+-- >>> dropLength [1..] [1,2,3]+-- [] dropLength :: [a] -> [b] -> [b] dropLength [] y = y dropLength _ [] = []@@ -317,6 +366,9 @@  -- A version of dropLength that returns Nothing if the second list runs out of -- elements before the first.+--+-- >>> dropLengthMaybe [1..] [1,2,3]+-- Nothing dropLengthMaybe :: [a] -> [b] -> Maybe [b] dropLengthMaybe [] y = Just y dropLengthMaybe _ [] = Nothing@@ -326,10 +378,11 @@ -- iff the first list is contained, wholly and intact, -- anywhere within the second. ----- Example:+-- >>> isInfixOf "Haskell" "I really like Haskell."+-- True ----- >isInfixOf "Haskell" "I really like Haskell." == True--- >isInfixOf "Ial" "I really like Haskell." == False+-- >>> isInfixOf "Ial" "I really like Haskell."+-- False isInfixOf               :: (Eq a) => [a] -> [a] -> Bool isInfixOf needle haystack = any (isPrefixOf needle) (tails haystack) @@ -338,14 +391,20 @@ -- (The name 'nub' means \`essence\'.) -- It is a special case of 'nubBy', which allows the programmer to supply -- their own equality test.+--+-- >>> nub [1,2,3,4,3,2,1,2,4,3,5]+-- [1,2,3,4,5] nub                     :: (Eq a) => [a] -> [a] nub                     =  nubBy (==)  -- | The 'nubBy' function behaves just like 'nub', except it uses a -- user-supplied equality predicate instead of the overloaded '==' -- function.+--+-- >>> nubBy (\x y -> mod x 3 == mod y 3) [1,2,4,5,6]+-- [1,2,6] nubBy                   :: (a -> a -> Bool) -> [a] -> [a]-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) nubBy eq []             =  [] nubBy eq (x:xs)         =  x : nubBy eq (filter (\ y -> not (eq x y)) xs) #else@@ -373,16 +432,19 @@ -- | 'delete' @x@ removes the first occurrence of @x@ from its list argument. -- For example, ----- > delete 'a' "banana" == "bnana"+-- >>> delete 'a' "banana"+-- "bnana" -- -- It is a special case of 'deleteBy', which allows the programmer to -- supply their own equality test.- delete                  :: (Eq a) => a -> [a] -> [a] delete                  =  deleteBy (==)  -- | The 'deleteBy' function behaves like 'delete', but takes a -- user-supplied equality predicate.+--+-- >>> deleteBy (<=) 4 [1..10]+-- [1,2,3,5,6,7,8,9,10] deleteBy                :: (a -> a -> Bool) -> a -> [a] -> [a] deleteBy _  _ []        = [] deleteBy eq x (y:ys)    = if x `eq` y then ys else y : deleteBy eq x ys@@ -393,6 +455,9 @@ -- -- > (xs ++ ys) \\ xs == ys. --+-- >>> "Hello World!" \\ "ell W"+-- "Hoorld!"+-- -- It is a special case of 'deleteFirstsBy', which allows the programmer -- to supply their own equality test. @@ -402,7 +467,8 @@ -- | The 'union' function returns the list union of the two lists. -- For example, ----- > "dog" `union` "cow" == "dogcw"+-- >>> "dog" `union` "cow"+-- "dogcw" -- -- Duplicates, and elements of the first list, are removed from the -- the second list, but if the first list contains duplicates, so will@@ -420,11 +486,13 @@ -- | The 'intersect' function takes the list intersection of two lists. -- For example, ----- > [1,2,3,4] `intersect` [2,4,6,8] == [2,4]+-- >>> [1,2,3,4] `intersect` [2,4,6,8]+-- [2,4] -- -- If the first list contains duplicates, so will the result. ----- > [1,2,2,3,4] `intersect` [6,4,4,2] == [2,2,4]+-- >>> [1,2,2,3,4] `intersect` [6,4,4,2]+-- [2,2,4] -- -- It is a special case of 'intersectBy', which allows the programmer to -- supply their own equality test. If the element is found in both the first@@ -443,8 +511,8 @@ -- \`intersperses\' that element between the elements of the list. -- For example, ----- > intersperse ',' "abcde" == "a,b,c,d,e"-+-- >>> intersperse ',' "abcde"+-- "a,b,c,d,e" intersperse             :: a -> [a] -> [a] intersperse _   []      = [] intersperse sep (x:xs)  = x : prependToAll sep xs@@ -461,18 +529,22 @@ -- | 'intercalate' @xs xss@ is equivalent to @('concat' ('intersperse' xs xss))@. -- It inserts the list @xs@ in between the lists in @xss@ and concatenates the -- result.+--+-- >>> intercalate ", " ["Lorem", "ipsum", "dolor"]+-- "Lorem, ipsum, dolor" intercalate :: [a] -> [[a]] -> [a] intercalate xs xss = concat (intersperse xs xss)  -- | The 'transpose' function transposes the rows and columns of its argument. -- For example, ----- > transpose [[1,2,3],[4,5,6]] == [[1,4],[2,5],[3,6]]+-- >>> transpose [[1,2,3],[4,5,6]]+-- [[1,4],[2,5],[3,6]] -- -- If some of the rows are shorter than the following rows, their elements are skipped: ----- > transpose [[10,11],[20],[],[30,31,32]] == [[10,20,30],[11,31],[32]]-+-- >>> transpose [[10,11],[20],[],[30,31,32]]+-- [[10,20,30],[11,31],[32]] transpose               :: [[a]] -> [[a]] transpose []             = [] transpose ([]   : xss)   = transpose xss@@ -484,7 +556,9 @@ -- predicate, respectively; i.e., -- -- > partition p xs == (filter p xs, filter (not . p) xs)-+--+-- >>> partition (`elem` "aeiou") "Hello World!"+-- ("eoo","Hll Wrld!") partition               :: (a -> Bool) -> [a] -> ([a],[a]) {-# INLINE partition #-} partition p xs = foldr (select p) ([],[]) xs@@ -548,6 +622,9 @@ -- is sorted before the call, the result will also be sorted. -- It is a special case of 'insertBy', which allows the programmer to -- supply their own comparison function.+--+-- >>> insert 4 [1,2,3,5,6,7]+-- [1,2,3,4,5,6,7] insert :: Ord a => a -> [a] -> [a] insert e ls = insertBy (compare) e ls @@ -562,6 +639,11 @@ -- | The 'maximumBy' function takes a comparison function and a list -- and returns the greatest element of the list by the comparison function. -- The list must be finite and non-empty.+--+-- We can use this to find the longest entry of a list:+--+-- >>> maximumBy (\x y -> compare (length x) (length y)) ["Hello", "World", "!", "Longest", "bar"]+-- "Longest" maximumBy               :: (a -> a -> Ordering) -> [a] -> a maximumBy _ []          =  errorWithoutStackTrace "List.maximumBy: empty list" maximumBy cmp xs        =  foldl1 maxBy xs@@ -573,6 +655,11 @@ -- | The 'minimumBy' function takes a comparison function and a list -- and returns the least element of the list by the comparison function. -- The list must be finite and non-empty.+--+-- We can use this to find the shortest entry of a list:+--+-- >>> minimumBy (\x y -> compare (length x) (length y)) ["Hello", "World", "!", "Longest", "bar"]+-- "!" minimumBy               :: (a -> a -> Ordering) -> [a] -> a minimumBy _ []          =  errorWithoutStackTrace "List.minimumBy: empty list" minimumBy cmp xs        =  foldl1 minBy xs@@ -733,7 +820,8 @@ -- that the concatenation of the result is equal to the argument.  Moreover, -- each sublist in the result contains only equal elements.  For example, ----- > group "Mississippi" = ["M","i","ss","i","ss","i","pp","i"]+-- >>> group "Mississippi"+-- ["M","i","ss","i","ss","i","pp","i"] -- -- It is a special case of 'groupBy', which allows the programmer to supply -- their own equality test.@@ -749,7 +837,8 @@ -- | The 'inits' function returns all initial segments of the argument, -- shortest first.  For example, ----- > inits "abc" == ["","a","ab","abc"]+-- >>> inits "abc"+-- ["","a","ab","abc"] -- -- Note that 'inits' has the following strictness property: -- @inits (xs ++ _|_) = inits xs ++ _|_@@@ -767,7 +856,8 @@ -- | The 'tails' function returns all final segments of the argument, -- longest first.  For example, ----- > tails "abc" == ["abc", "bc", "c",""]+-- >>> tails "abc"+-- ["abc","bc","c",""] -- -- Note that 'tails' has the following strictness property: -- @tails _|_ = _|_ : _|_@@@ -781,14 +871,16 @@  -- | The 'subsequences' function returns the list of all subsequences of the argument. ----- > subsequences "abc" == ["","a","b","ab","c","ac","bc","abc"]+-- >>> subsequences "abc"+-- ["","a","b","ab","c","ac","bc","abc"] subsequences            :: [a] -> [[a]] subsequences xs         =  [] : nonEmptySubsequences xs  -- | The 'nonEmptySubsequences' function returns the list of all subsequences of the argument, --   except for the empty list. ----- > nonEmptySubsequences "abc" == ["a","b","ab","c","ac","bc","abc"]+-- >>> nonEmptySubsequences "abc"+-- ["a","b","ab","c","ac","bc","abc"] nonEmptySubsequences         :: [a] -> [[a]] nonEmptySubsequences []      =  [] nonEmptySubsequences (x:xs)  =  [x] : foldr f [] (nonEmptySubsequences xs)@@ -797,7 +889,8 @@  -- | The 'permutations' function returns the list of all permutations of the argument. ----- > permutations "abc" == ["abc","bac","cba","bca","cab","acb"]+-- >>> permutations "abc"+-- ["abc","bac","cba","bca","cab","acb"] permutations            :: [a] -> [[a]] permutations xs0        =  xs0 : perms xs0 []   where@@ -818,12 +911,18 @@ -- -- Elements are arranged from from lowest to highest, keeping duplicates in -- the order they appeared in the input.+--+-- >>> sort [1,6,4,3,2,5]+-- [1,2,3,4,5,6] sort :: (Ord a) => [a] -> [a]  -- | The 'sortBy' function is the non-overloaded version of 'sort'.+--+-- >>> sortBy (\(a,_) (b,_) -> compare a b) [(2, "world"), (4, "!"), (1, "Hello")]+-- [(1,"Hello"),(2,"world"),(4,"!")] sortBy :: (a -> a -> Ordering) -> [a] -> [a] -#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) sort = sortBy compare sortBy cmp = foldr (insertBy cmp) [] #else@@ -854,12 +953,14 @@      ascending a as (b:bs)       | a `cmp` b /= GT = ascending b (\ys -> as (a:ys)) bs-    ascending a as bs   = as [a]: sequences bs+    ascending a as bs   = let !x = as [a]+                          in x : sequences bs      mergeAll [x] = x     mergeAll xs  = mergeAll (mergePairs xs) -    mergePairs (a:b:xs) = merge a b: mergePairs xs+    mergePairs (a:b:xs) = let !x = merge a b+                          in x : mergePairs xs     mergePairs xs       = xs      merge as@(a:as') bs@(b:bs')@@ -984,6 +1085,9 @@ -- Elements are arranged from from lowest to highest, keeping duplicates in -- the order they appeared in the input. --+-- >>> sortOn fst [(2, "world"), (4, "!"), (1, "Hello")]+-- [(1,"Hello"),(2,"world"),(4,"!")]+-- -- @since 4.8.0.0 sortOn :: Ord b => (a -> b) -> [a] -> [a] sortOn f =@@ -1009,8 +1113,8 @@ -- -- A simple use of unfoldr: ----- > unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10--- >  [10,9,8,7,6,5,4,3,2,1]+-- >>> unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10+-- [10,9,8,7,6,5,4,3,2,1] --  -- Note [INLINE unfoldr]@@ -1055,14 +1159,27 @@ -- last part of the string is considered a line even if it doesn't end -- with a newline. For example, ----- > lines "" == []--- > lines "\n" == [""]--- > lines "one" == ["one"]--- > lines "one\n" == ["one"]--- > lines "one\n\n" == ["one",""]--- > lines "one\ntwo" == ["one","two"]--- > lines "one\ntwo\n" == ["one","two"]+-- >>> lines ""+-- [] --+-- >>> lines "\n"+-- [""]+--+-- >>> lines "one"+-- ["one"]+--+-- >>> lines "one\n"+-- ["one"]+--+-- >>> lines "one\n\n"+-- ["one",""]+--+-- >>> lines "one\ntwo"+-- ["one","two"]+--+-- >>> lines "one\ntwo\n"+-- ["one","two"]+-- -- Thus @'lines' s@ contains at least as many elements as newlines in @s@. lines                   :: String -> [String] lines ""                =  []@@ -1079,8 +1196,11 @@  -- | 'unlines' is an inverse operation to 'lines'. -- It joins lines, after appending a terminating newline to each.+--+-- >>> unlines ["Hello", "World", "!"]+-- "Hello\nWorld\n!\n" unlines                 :: [String] -> String-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) unlines                 =  concatMap (++ "\n") #else -- HBC version (stolen)@@ -1091,6 +1211,9 @@  -- | 'words' breaks a string up into a list of words, which were delimited -- by white space.+--+-- >>> words "Lorem ipsum\ndolor"+-- ["Lorem","ipsum","dolor"] words                   :: String -> [String] {-# NOINLINE [1] words #-} words s                 =  case dropWhile {-partain:Char.-}isSpace s of@@ -1114,8 +1237,11 @@  -- | 'unwords' is an inverse operation to 'words'. -- It joins words with separating spaces.+--+-- >>> unwords ["Lorem", "ipsum", "dolor"]+-- "Lorem ipsum dolor" unwords                 :: [String] -> String-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) unwords []              =  "" unwords ws              =  foldr1 (\w s -> w ++ ' ':s) ws #else
Data/Ord.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}  ----------------------------------------------------------------------------- -- |@@ -25,6 +26,7 @@ import GHC.Base import GHC.Show import GHC.Read+import GHC.Num  -- |  -- > comparing p x y = compare (p x) (p y)@@ -43,11 +45,30 @@ -- This is particularly useful when sorting in generalised list comprehensions, -- as in: @then sortWith by 'Down' x@ ----- Provides 'Show' and 'Read' instances (/since: 4.7.0.0/).--- -- @since 4.6.0.0-newtype Down a = Down a deriving (Eq, Show, Read)+newtype Down a = Down a+    deriving+      ( Eq+      , Show -- ^ @since 4.7.0.0+      , Read -- ^ @since 4.7.0.0+      , Num -- ^ @since 4.11.0.0+      , Semigroup -- ^ @since 4.11.0.0+      , Monoid -- ^ @since 4.11.0.0+      )  -- | @since 4.6.0.0 instance Ord a => Ord (Down a) where     compare (Down x) (Down y) = y `compare` x++-- | @since 4.11.0.0+instance Functor Down where+    fmap = coerce++-- | @since 4.11.0.0+instance Applicative Down where+    pure = Down+    (<*>) = coerce++-- | @since 4.11.0.0+instance Monad Down where+    Down a >>= k = k a
Data/Proxy.hs view
@@ -28,9 +28,35 @@ import GHC.Enum import GHC.Arr --- | A concrete, poly-kinded proxy type-data Proxy t = Proxy deriving Bounded+-- $setup+-- >>> import Data.Void+-- >>> import Prelude +-- | 'Proxy' is a type that holds no data, but has a phantom parameter of+-- arbitrary type (or even kind). Its use is to provide type information, even+-- though there is no value available of that type (or it may be too costly to+-- create one).+--+-- Historically, @'Proxy' :: 'Proxy' a@ is a safer alternative to the+-- @'undefined :: a'@ idiom.+--+-- >>> Proxy :: Proxy (Void, Int -> Int)+-- Proxy+--+-- Proxy can even hold types of higher kinds,+--+-- >>> Proxy :: Proxy Either+-- Proxy+--+-- >>> Proxy :: Proxy Functor+-- Proxy+--+-- >>> Proxy :: Proxy complicatedStructure+-- Proxy+data Proxy t = Proxy deriving ( Bounded+                              , Read -- ^ @since 4.7.0.0+                              )+ -- | A concrete, promotable proxy type, for use at the kind level -- There are no instances for this because it is intended at the kind level only data KProxy (t :: *) = KProxy@@ -52,10 +78,6 @@   showsPrec _ _ = showString "Proxy"  -- | @since 4.7.0.0-instance Read (Proxy s) where-  readsPrec d = readParen (d > 10) (\r -> [(Proxy, s) | ("Proxy",s) <- lex r ])---- | @since 4.7.0.0 instance Enum (Proxy s) where     succ _               = errorWithoutStackTrace "Proxy.succ"     pred _               = errorWithoutStackTrace "Proxy.pred"@@ -76,10 +98,15 @@     unsafeIndex _ _   = 0     unsafeRangeSize _ = 1 +-- | @since 4.9.0.0+instance Semigroup (Proxy s) where+    _ <> _ = Proxy+    sconcat _ = Proxy+    stimes _ _ = Proxy+ -- | @since 4.7.0.0 instance Monoid (Proxy s) where     mempty = Proxy-    mappend _ _ = Proxy     mconcat _ = Proxy  -- | @since 4.7.0.0@@ -113,6 +140,19 @@ -- It is usually used as an infix operator, and its typing forces its first -- argument (which is usually overloaded) to have the same type as the tag -- of the second.+--+-- >>> import Data.Word+-- >>> :type asProxyTypeOf 123 (Proxy :: Proxy Word8)+-- asProxyTypeOf 123 (Proxy :: Proxy Word8) :: Word8+--+-- Note the lower-case @proxy@ in the definition. This allows any type+-- constructor with just one argument to be passed to the function, for example+-- we could also write+--+-- >>> import Data.Word+-- >>> :type asProxyTypeOf 123 (Just (undefined :: Word8))+-- asProxyTypeOf 123 (Just (undefined :: Word8)) :: Word8 asProxyTypeOf :: a -> proxy a -> a asProxyTypeOf = const {-# INLINE asProxyTypeOf #-}+
Data/Ratio.hs view
@@ -47,27 +47,32 @@ -- and abs r' < d', and the simplest rational is q%1 + the reciprocal of -- the simplest rational between d'%r' and d%r. -approxRational          :: (RealFrac a) => a -> a -> Rational-approxRational rat eps  =  simplest (rat-eps) (rat+eps)-        where simplest x y | y < x      =  simplest y x-                           | x == y     =  xr-                           | x > 0      =  simplest' n d n' d'-                           | y < 0      =  - simplest' (-n') d' (-n) d-                           | otherwise  =  0 :% 1-                                        where xr  = toRational x-                                              n   = numerator xr-                                              d   = denominator xr-                                              nd' = toRational y-                                              n'  = numerator nd'-                                              d'  = denominator nd'+approxRational :: (RealFrac a) => a -> a -> Rational+approxRational rat eps =+    -- We convert rat and eps to rational *before* subtracting/adding since+    -- otherwise we may overflow. This was the cause of #14425.+    simplest (toRational rat - toRational eps) (toRational rat + toRational eps)+  where+    simplest x y+      | y < x      =  simplest y x+      | x == y     =  xr+      | x > 0      =  simplest' n d n' d'+      | y < 0      =  - simplest' (-n') d' (-n) d+      | otherwise  =  0 :% 1+      where xr  = toRational x+            n   = numerator xr+            d   = denominator xr+            nd' = toRational y+            n'  = numerator nd'+            d'  = denominator nd' -              simplest' n d n' d'       -- assumes 0 < n%d < n'%d'-                        | r == 0     =  q :% 1-                        | q /= q'    =  (q+1) :% 1-                        | otherwise  =  (q*n''+d'') :% n''-                                     where (q,r)      =  quotRem n d-                                           (q',r')    =  quotRem n' d'-                                           nd''       =  simplest' d' r' d r-                                           n''        =  numerator nd''-                                           d''        =  denominator nd''+    simplest' n d n' d'       -- assumes 0 < n%d < n'%d'+      | r == 0     =  q :% 1+      | q /= q'    =  (q+1) :% 1+      | otherwise  =  (q*n''+d'') :% n''+      where (q,r)      =  quotRem n d+            (q',r')    =  quotRem n' d'+            nd''       =  simplest' d' r' d r+            n''        =  numerator nd''+            d''        =  denominator nd'' 
Data/STRef.hs view
@@ -5,7 +5,7 @@ -- Module      :  Data.STRef -- Copyright   :  (c) The University of Glasgow 2001 -- License     :  BSD-style (see the file libraries/base/LICENSE)--- +-- -- Maintainer  :  libraries@haskell.org -- Stability   :  experimental -- Portability :  non-portable (uses Control.Monad.ST)@@ -29,16 +29,30 @@  -- | Mutate the contents of an 'STRef'. --+-- >>> :{+-- runST (do+--     ref <- newSTRef ""+--     modifySTRef ref (const "world")+--     modifySTRef ref (++ "!")+--     modifySTRef ref ("Hello, " ++)+--     readSTRef ref )+-- :}+-- "Hello, world!"+-- -- Be warned that 'modifySTRef' does not apply the function strictly.  This -- means if the program calls 'modifySTRef' many times, but seldomly uses the -- value, thunks will pile up in memory resulting in a space leak.  This is a -- common mistake made when using an STRef as a counter.  For example, the--- following will leak memory and likely produce a stack overflow:+-- following will leak memory and may produce a stack overflow: ----- >print $ runST $ do--- >    ref <- newSTRef 0--- >    replicateM_ 1000000 $ modifySTRef ref (+1)--- >    readSTRef ref+-- >>> import Control.Monad (replicateM_)+-- >>> :{+-- print (runST (do+--     ref <- newSTRef 0+--     replicateM_ 1000 $ modifySTRef ref (+1)+--     readSTRef ref ))+-- :}+-- 1000 -- -- To avoid this problem, use 'modifySTRef'' instead. modifySTRef :: STRef s a -> (a -> a) -> ST s ()
Data/Semigroup.hs view
@@ -48,7 +48,6 @@   , Last(..)   , WrappedMonoid(..)   -- * Re-exported monoids from Data.Monoid-  , Monoid(..)   , Dual(..)   , Endo(..)   , All(..)@@ -69,6 +68,10 @@  import           Prelude             hiding (foldr1) +import GHC.Base (Semigroup(..))++import           Data.Semigroup.Internal+ import           Control.Applicative import           Control.Monad import           Control.Monad.Fix@@ -77,252 +80,19 @@ import           Data.Bitraversable import           Data.Coerce import           Data.Data-import           Data.Functor.Identity-import           Data.List.NonEmpty import           Data.Monoid         (All (..), Any (..), Dual (..), Endo (..),                                       Product (..), Sum (..))-import           Data.Monoid         (Alt (..))-import qualified Data.Monoid         as Monoid-import           Data.Void-#ifndef mingw32_HOST_OS-import           GHC.Event           (Event, Lifetime)-#endif+-- import qualified Data.Monoid         as Monoid import           GHC.Generics -infixr 6 <>---- | The class of semigroups (types with an associative binary operation).------ @since 4.9.0.0-class Semigroup a where-  -- | An associative operation.-  ---  -- @-  -- (a '<>' b) '<>' c = a '<>' (b '<>' c)-  -- @-  ---  -- If @a@ is also a 'Monoid' we further require-  ---  -- @-  -- ('<>') = 'mappend'-  -- @-  (<>) :: a -> a -> a--  default (<>) :: Monoid a => a -> a -> a-  (<>) = mappend--  -- | Reduce a non-empty list with @\<\>@-  ---  -- The default definition should be sufficient, but this can be-  -- overridden for efficiency.-  ---  sconcat :: NonEmpty a -> a-  sconcat (a :| as) = go a as where-    go b (c:cs) = b <> go c cs-    go b []     = b--  -- | Repeat a value @n@ times.-  ---  -- Given that this works on a 'Semigroup' it is allowed to fail if-  -- you request 0 or fewer repetitions, and the default definition-  -- will do so.-  ---  -- By making this a member of the class, idempotent semigroups and monoids can-  -- upgrade this to execute in /O(1)/ by picking-  -- @stimes = stimesIdempotent@ or @stimes = stimesIdempotentMonoid@-  -- respectively.-  stimes :: Integral b => b -> a -> a-  stimes y0 x0-    | y0 <= 0   = errorWithoutStackTrace "stimes: positive multiplier expected"-    | otherwise = f x0 y0-    where-      f x y-        | even y = f (x <> x) (y `quot` 2)-        | y == 1 = x-        | otherwise = g (x <> x) (pred y  `quot` 2) x-      g x y z-        | even y = g (x <> x) (y `quot` 2) z-        | y == 1 = x <> z-        | otherwise = g (x <> x) (pred y `quot` 2) (x <> z)- -- | A generalization of 'Data.List.cycle' to an arbitrary 'Semigroup'. -- May fail to terminate for some values in some semigroups. cycle1 :: Semigroup m => m -> m cycle1 xs = xs' where xs' = xs <> xs' --- | @since 4.9.0.0-instance Semigroup () where-  _ <> _ = ()-  sconcat _ = ()-  stimes _ _ = ()---- | @since 4.9.0.0-instance Semigroup b => Semigroup (a -> b) where-  f <> g = \a -> f a <> g a-  stimes n f e = stimes n (f e)---- | @since 4.9.0.0-instance Semigroup [a] where-  (<>) = (++)-  stimes n x-    | n < 0 = errorWithoutStackTrace "stimes: [], negative multiplier"-    | otherwise = rep n-    where-      rep 0 = []-      rep i = x ++ rep (i - 1)---- | @since 4.9.0.0-instance Semigroup a => Semigroup (Maybe a) where-  Nothing <> b       = b-  a       <> Nothing = a-  Just a  <> Just b  = Just (a <> b)-  stimes _ Nothing  = Nothing-  stimes n (Just a) = case compare n 0 of-    LT -> errorWithoutStackTrace "stimes: Maybe, negative multiplier"-    EQ -> Nothing-    GT -> Just (stimes n a)---- | @since 4.9.0.0-instance Semigroup (Either a b) where-  Left _ <> b = b-  a      <> _ = a-  stimes = stimesIdempotent---- | @since 4.9.0.0-instance (Semigroup a, Semigroup b) => Semigroup (a, b) where-  (a,b) <> (a',b') = (a<>a',b<>b')-  stimes n (a,b) = (stimes n a, stimes n b)---- | @since 4.9.0.0-instance (Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c) where-  (a,b,c) <> (a',b',c') = (a<>a',b<>b',c<>c')-  stimes n (a,b,c) = (stimes n a, stimes n b, stimes n c)---- | @since 4.9.0.0-instance (Semigroup a, Semigroup b, Semigroup c, Semigroup d)-         => Semigroup (a, b, c, d) where-  (a,b,c,d) <> (a',b',c',d') = (a<>a',b<>b',c<>c',d<>d')-  stimes n (a,b,c,d) = (stimes n a, stimes n b, stimes n c, stimes n d)---- | @since 4.9.0.0-instance (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e)-         => Semigroup (a, b, c, d, e) where-  (a,b,c,d,e) <> (a',b',c',d',e') = (a<>a',b<>b',c<>c',d<>d',e<>e')-  stimes n (a,b,c,d,e) =-      (stimes n a, stimes n b, stimes n c, stimes n d, stimes n e)---- | @since 4.9.0.0-instance Semigroup Ordering where-  LT <> _ = LT-  EQ <> y = y-  GT <> _ = GT-  stimes = stimesIdempotentMonoid---- | @since 4.9.0.0-instance Semigroup a => Semigroup (Dual a) where-  Dual a <> Dual b = Dual (b <> a)-  stimes n (Dual a) = Dual (stimes n a)---- | @since 4.9.0.0-instance Semigroup (Endo a) where-  (<>) = coerce ((.) :: (a -> a) -> (a -> a) -> (a -> a))-  stimes = stimesMonoid---- | @since 4.9.0.0-instance Semigroup All where-  (<>) = coerce (&&)-  stimes = stimesIdempotentMonoid---- | @since 4.9.0.0-instance Semigroup Any where-  (<>) = coerce (||)-  stimes = stimesIdempotentMonoid----- | @since 4.9.0.0-instance Num a => Semigroup (Sum a) where-  (<>) = coerce ((+) :: a -> a -> a)-  stimes n (Sum a) = Sum (fromIntegral n * a)---- | @since 4.9.0.0-instance Num a => Semigroup (Product a) where-  (<>) = coerce ((*) :: a -> a -> a)-  stimes n (Product a) = Product (a ^ n)---- | This is a valid definition of 'stimes' for a 'Monoid'.------ Unlike the default definition of 'stimes', it is defined for 0--- and so it should be preferred where possible.-stimesMonoid :: (Integral b, Monoid a) => b -> a -> a-stimesMonoid n x0 = case compare n 0 of-  LT -> errorWithoutStackTrace "stimesMonoid: negative multiplier"-  EQ -> mempty-  GT -> f x0 n-    where-      f x y-        | even y = f (x `mappend` x) (y `quot` 2)-        | y == 1 = x-        | otherwise = g (x `mappend` x) (pred y  `quot` 2) x-      g x y z-        | even y = g (x `mappend` x) (y `quot` 2) z-        | y == 1 = x `mappend` z-        | otherwise = g (x `mappend` x) (pred y `quot` 2) (x `mappend` z)---- | This is a valid definition of 'stimes' for an idempotent 'Monoid'.------ When @mappend x x = x@, this definition should be preferred, because it--- works in /O(1)/ rather than /O(log n)/-stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a-stimesIdempotentMonoid n x = case compare n 0 of-  LT -> errorWithoutStackTrace "stimesIdempotentMonoid: negative multiplier"-  EQ -> mempty-  GT -> x---- | This is a valid definition of 'stimes' for an idempotent 'Semigroup'.------ When @x <> x = x@, this definition should be preferred, because it--- works in /O(1)/ rather than /O(log n)/.-stimesIdempotent :: Integral b => b -> a -> a-stimesIdempotent n x-  | n <= 0 = errorWithoutStackTrace "stimesIdempotent: positive multiplier expected"-  | otherwise = x---- | @since 4.9.0.0-instance Semigroup a => Semigroup (Identity a) where-  (<>) = coerce ((<>) :: a -> a -> a)-  stimes n (Identity a) = Identity (stimes n a)---- | @since 4.9.0.0-instance Semigroup a => Semigroup (Const a b) where-  (<>) = coerce ((<>) :: a -> a -> a)-  stimes n (Const a) = Const (stimes n a)---- | @since 4.9.0.0-instance Semigroup (Monoid.First a) where-  Monoid.First Nothing <> b = b-  a                    <> _ = a-  stimes = stimesIdempotentMonoid---- | @since 4.9.0.0-instance Semigroup (Monoid.Last a) where-  a <> Monoid.Last Nothing = a-  _ <> b                   = b-  stimes = stimesIdempotentMonoid---- | @since 4.9.0.0-instance Alternative f => Semigroup (Alt f a) where-  (<>) = coerce ((<|>) :: f a -> f a -> f a)-  stimes = stimesMonoid---- | @since 4.9.0.0-instance Semigroup Void where-  a <> _ = a-  stimes = stimesIdempotent---- | @since 4.9.0.0-instance Semigroup (NonEmpty a) where-  (a :| as) <> ~(b :| bs) = a :| (as ++ b : bs)-+-- | This lets you use a difference list of a 'Semigroup' as a 'Monoid'.+diff :: Semigroup m => m -> Endo m+diff = Endo . (<>)  newtype Min a = Min { getMin :: a }   deriving (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1)@@ -347,7 +117,6 @@ -- | @since 4.9.0.0 instance (Ord a, Bounded a) => Monoid (Min a) where   mempty = maxBound-  mappend = (<>)  -- | @since 4.9.0.0 instance Functor Min where@@ -410,7 +179,6 @@ -- | @since 4.9.0.0 instance (Ord a, Bounded a) => Monoid (Max a) where   mempty = minBound-  mappend = (<>)  -- | @since 4.9.0.0 instance Functor Max where@@ -491,7 +259,7 @@  -- | @since 4.10.0.0 instance Bifoldable Arg where-  bifoldMap f g (Arg a b) = f a `mappend` g b+  bifoldMap f g (Arg a b) = f a <> g b  -- | @since 4.10.0.0 instance Bitraversable Arg where@@ -599,6 +367,9 @@   mfix f = fix (f . getLast)  -- | Provide a Semigroup for an arbitrary Monoid.+--+-- __NOTE__: This is not needed anymore since 'Semigroup' became a superclass of+-- 'Monoid' in /base-4.11/ and this newtype be deprecated at some point in the future. newtype WrappedMonoid m = WrapMonoid { unwrapMonoid :: m }   deriving (Bounded, Eq, Ord, Show, Read, Data, Generic, Generic1) @@ -609,7 +380,6 @@ -- | @since 4.9.0.0 instance Monoid m => Monoid (WrappedMonoid m) where   mempty = WrapMonoid mempty-  mappend = (<>)  -- | @since 4.9.0.0 instance Enum a => Enum (WrappedMonoid a) where@@ -693,40 +463,15 @@ -- | @since 4.9.0.0 instance Semigroup a => Semigroup (Option a) where   (<>) = coerce ((<>) :: Maybe a -> Maybe a -> Maybe a)-+#if !defined(__HADDOCK_VERSION__)+    -- workaround https://github.com/haskell/haddock/issues/680   stimes _ (Option Nothing) = Option Nothing   stimes n (Option (Just a)) = case compare n 0 of     LT -> errorWithoutStackTrace "stimes: Option, negative multiplier"     EQ -> Option Nothing     GT -> Option (Just (stimes n a))+#endif  -- | @since 4.9.0.0 instance Semigroup a => Monoid (Option a) where   mempty = Option Nothing-  mappend = (<>)---- | This lets you use a difference list of a 'Semigroup' as a 'Monoid'.-diff :: Semigroup m => m -> Endo m-diff = Endo . (<>)---- | @since 4.9.0.0-instance Semigroup (Proxy s) where-  _ <> _ = Proxy-  sconcat _ = Proxy-  stimes _ _ = Proxy---- | @since 4.10.0.0-instance Semigroup a => Semigroup (IO a) where-    (<>) = liftA2 (<>)--#ifndef mingw32_HOST_OS--- | @since 4.10.0.0-instance Semigroup Event where-    (<>) = mappend-    stimes = stimesMonoid---- | @since 4.10.0.0-instance Semigroup Lifetime where-    (<>) = mappend-    stimes = stimesMonoid-#endif
+ Data/Semigroup/Internal.hs view
@@ -0,0 +1,264 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE ScopedTypeVariables #-}++-- | Auxilary definitions for 'Semigroup'+--+-- This module provides some @newtype@ wrappers and helpers which are+-- reexported from the "Data.Semigroup" module or imported directly+-- by some other modules.+--+-- This module also provides internal definitions related to the+-- 'Semigroup' class some.+--+-- This module exists mostly to simplify or workaround import-graph+-- issues; there is also a .hs-boot file to allow "GHC.Base" and other+-- modules to import method default implementations for 'stimes'+--+-- @since 4.11.0.0+module Data.Semigroup.Internal where++import GHC.Base hiding (Any)+import GHC.Enum+import GHC.Num+import GHC.Read+import GHC.Show+import GHC.Generics+import GHC.Real++-- | This is a valid definition of 'stimes' for an idempotent 'Semigroup'.+--+-- When @x <> x = x@, this definition should be preferred, because it+-- works in /O(1)/ rather than /O(log n)/.+stimesIdempotent :: Integral b => b -> a -> a+stimesIdempotent n x+  | n <= 0 = errorWithoutStackTrace "stimesIdempotent: positive multiplier expected"+  | otherwise = x++-- | This is a valid definition of 'stimes' for an idempotent 'Monoid'.+--+-- When @mappend x x = x@, this definition should be preferred, because it+-- works in /O(1)/ rather than /O(log n)/+stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a+stimesIdempotentMonoid n x = case compare n 0 of+  LT -> errorWithoutStackTrace "stimesIdempotentMonoid: negative multiplier"+  EQ -> mempty+  GT -> x++-- | This is a valid definition of 'stimes' for a 'Monoid'.+--+-- Unlike the default definition of 'stimes', it is defined for 0+-- and so it should be preferred where possible.+stimesMonoid :: (Integral b, Monoid a) => b -> a -> a+stimesMonoid n x0 = case compare n 0 of+  LT -> errorWithoutStackTrace "stimesMonoid: negative multiplier"+  EQ -> mempty+  GT -> f x0 n+    where+      f x y+        | even y = f (x `mappend` x) (y `quot` 2)+        | y == 1 = x+        | otherwise = g (x `mappend` x) (y `quot` 2) x               -- See Note [Half of y - 1]+      g x y z+        | even y = g (x `mappend` x) (y `quot` 2) z+        | y == 1 = x `mappend` z+        | otherwise = g (x `mappend` x) (y `quot` 2) (x `mappend` z) -- See Note [Half of y - 1]++-- this is used by the class definitionin GHC.Base;+-- it lives here to avoid cycles+stimesDefault :: (Integral b, Semigroup a) => b -> a -> a+stimesDefault y0 x0+  | y0 <= 0   = errorWithoutStackTrace "stimes: positive multiplier expected"+  | otherwise = f x0 y0+  where+    f x y+      | even y = f (x <> x) (y `quot` 2)+      | y == 1 = x+      | otherwise = g (x <> x) (y `quot` 2) x        -- See Note [Half of y - 1]+    g x y z+      | even y = g (x <> x) (y `quot` 2) z+      | y == 1 = x <> z+      | otherwise = g (x <> x) (y `quot` 2) (x <> z) -- See Note [Half of y - 1]++{- Note [Half of y - 1]+   ~~~~~~~~~~~~~~~~~~~~~+   Since y is guaranteed to be odd and positive here,+   half of y - 1 can be computed as y `quot` 2, optimising subtraction away.+-}++stimesMaybe :: (Integral b, Semigroup a) => b -> Maybe a -> Maybe a+stimesMaybe _ Nothing = Nothing+stimesMaybe n (Just a) = case compare n 0 of+    LT -> errorWithoutStackTrace "stimes: Maybe, negative multiplier"+    EQ -> Nothing+    GT -> Just (stimes n a)++stimesList  :: Integral b => b -> [a] -> [a]+stimesList n x+  | n < 0 = errorWithoutStackTrace "stimes: [], negative multiplier"+  | otherwise = rep n+  where+    rep 0 = []+    rep i = x ++ rep (i - 1)++-- | The dual of a 'Monoid', obtained by swapping the arguments of 'mappend'.+--+-- >>> getDual (mappend (Dual "Hello") (Dual "World"))+-- "WorldHello"+newtype Dual a = Dual { getDual :: a }+        deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1)++-- | @since 4.9.0.0+instance Semigroup a => Semigroup (Dual a) where+        Dual a <> Dual b = Dual (b <> a)+        stimes n (Dual a) = Dual (stimes n a)++-- | @since 2.01+instance Monoid a => Monoid (Dual a) where+        mempty = Dual mempty++-- | @since 4.8.0.0+instance Functor Dual where+    fmap     = coerce++-- | @since 4.8.0.0+instance Applicative Dual where+    pure     = Dual+    (<*>)    = coerce++-- | @since 4.8.0.0+instance Monad Dual where+    m >>= k  = k (getDual m)++-- | The monoid of endomorphisms under composition.+--+-- >>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")+-- >>> appEndo computation "Haskell"+-- "Hello, Haskell!"+newtype Endo a = Endo { appEndo :: a -> a }+               deriving (Generic)++-- | @since 4.9.0.0+instance Semigroup (Endo a) where+        (<>) = coerce ((.) :: (a -> a) -> (a -> a) -> (a -> a))+        stimes = stimesMonoid++-- | @since 2.01+instance Monoid (Endo a) where+        mempty = Endo id++-- | Boolean monoid under conjunction ('&&').+--+-- >>> getAll (All True <> mempty <> All False)+-- False+--+-- >>> getAll (mconcat (map (\x -> All (even x)) [2,4,6,7,8]))+-- False+newtype All = All { getAll :: Bool }+        deriving (Eq, Ord, Read, Show, Bounded, Generic)++-- | @since 4.9.0.0+instance Semigroup All where+        (<>) = coerce (&&)+        stimes = stimesIdempotentMonoid++-- | @since 2.01+instance Monoid All where+        mempty = All True++-- | Boolean monoid under disjunction ('||').+--+-- >>> getAny (Any True <> mempty <> Any False)+-- True+--+-- >>> getAny (mconcat (map (\x -> Any (even x)) [2,4,6,7,8]))+-- True+newtype Any = Any { getAny :: Bool }+        deriving (Eq, Ord, Read, Show, Bounded, Generic)++-- | @since 4.9.0.0+instance Semigroup Any where+        (<>) = coerce (||)+        stimes = stimesIdempotentMonoid++-- | @since 2.01+instance Monoid Any where+        mempty = Any False++-- | Monoid under addition.+--+-- >>> getSum (Sum 1 <> Sum 2 <> mempty)+-- 3+newtype Sum a = Sum { getSum :: a }+        deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1, Num)++-- | @since 4.9.0.0+instance Num a => Semigroup (Sum a) where+        (<>) = coerce ((+) :: a -> a -> a)+        stimes n (Sum a) = Sum (fromIntegral n * a)++-- | @since 2.01+instance Num a => Monoid (Sum a) where+        mempty = Sum 0++-- | @since 4.8.0.0+instance Functor Sum where+    fmap     = coerce++-- | @since 4.8.0.0+instance Applicative Sum where+    pure     = Sum+    (<*>)    = coerce++-- | @since 4.8.0.0+instance Monad Sum where+    m >>= k  = k (getSum m)++-- | Monoid under multiplication.+--+-- >>> getProduct (Product 3 <> Product 4 <> mempty)+-- 12+newtype Product a = Product { getProduct :: a }+        deriving (Eq, Ord, Read, Show, Bounded, Generic, Generic1, Num)++-- | @since 4.9.0.0+instance Num a => Semigroup (Product a) where+        (<>) = coerce ((*) :: a -> a -> a)+        stimes n (Product a) = Product (a ^ n)+++-- | @since 2.01+instance Num a => Monoid (Product a) where+        mempty = Product 1++-- | @since 4.8.0.0+instance Functor Product where+    fmap     = coerce++-- | @since 4.8.0.0+instance Applicative Product where+    pure     = Product+    (<*>)    = coerce++-- | @since 4.8.0.0+instance Monad Product where+    m >>= k  = k (getProduct m)+++-- | Monoid under '<|>'.+--+-- @since 4.8.0.0+newtype Alt f a = Alt {getAlt :: f a}+  deriving (Generic, Generic1, Read, Show, Eq, Ord, Num, Enum,+            Monad, MonadPlus, Applicative, Alternative, Functor)++-- | @since 4.9.0.0+instance Alternative f => Semigroup (Alt f a) where+    (<>) = coerce ((<|>) :: f a -> f a -> f a)+    stimes = stimesMonoid++-- | @since 4.8.0.0+instance Alternative f => Monoid (Alt f a) where+    mempty = Alt empty
+ Data/Semigroup/Internal.hs-boot view
@@ -0,0 +1,12 @@+{-# LANGUAGE NoImplicitPrelude #-}++module Data.Semigroup.Internal where++import {-# SOURCE #-} GHC.Real (Integral)+import {-# SOURCE #-} GHC.Base (Semigroup,Monoid,Maybe)++stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a++stimesDefault :: (Integral b, Semigroup a) => b -> a -> a+stimesMaybe :: (Integral b, Semigroup a) => b -> Maybe a -> Maybe a+stimesList :: Integral b => b -> [a] -> [a]
Data/Traversable.hs view
@@ -64,7 +64,7 @@ import Data.Proxy ( Proxy(..) )  import GHC.Arr-import GHC.Base ( Applicative(..), Monad(..), Monoid, Maybe(..),+import GHC.Base ( Applicative(..), Monad(..), Monoid, Maybe(..), NonEmpty(..),                   ($), (.), id, flip ) import GHC.Generics import qualified GHC.List as List ( foldr )@@ -198,8 +198,8 @@  This gives rise to a list-instance of mapM looking like this -  $fTraversable[]_$ctaverse = ...code for traverse on lists...-       {-# INLINE $fTraversable[]_$ctaverse #-}+  $fTraversable[]_$ctraverse = ...code for traverse on lists...+       {-# INLINE $fTraversable[]_$ctraverse #-}   $fTraversable[]_$cmapM    = $fTraversable[]_$ctraverse  Now the $ctraverse obediently inlines into the RHS of $cmapM, /but/@@ -236,6 +236,10 @@     {-# INLINE traverse #-} -- so that traverse can fuse     traverse f = List.foldr cons_f (pure [])       where cons_f x ys = liftA2 (:) (f x) ys++-- | @since 4.9.0.0+instance Traversable NonEmpty where+  traverse f ~(a :| as) = liftA2 (:|) (f a) (traverse f as)  -- | @since 4.7.0.0 instance Traversable (Either a) where
Data/Tuple.hs view
@@ -6,7 +6,7 @@ -- Module      :  Data.Tuple -- Copyright   :  (c) The University of Glasgow 2001 -- License     :  BSD-style (see the file libraries/base/LICENSE)--- +-- -- Maintainer  :  libraries@haskell.org -- Stability   :  experimental -- Portability :  portable@@ -39,13 +39,32 @@ snd (_,y)               =  y  -- | 'curry' converts an uncurried function to a curried function.+--+-- ==== __Examples__+--+-- >>> curry fst 1 2+-- 1 curry                   :: ((a, b) -> c) -> a -> b -> c curry f x y             =  f (x, y)  -- | 'uncurry' converts a curried function to a function on pairs.+--+-- ==== __Examples__+--+-- >>> uncurry (+) (1,2)+-- 3+--+-- >>> uncurry ($) (show, 1)+-- "1"+--+-- >>> map (uncurry max) [(1,2), (3,4), (6,8)]+-- [2,4,8] uncurry                 :: (a -> b -> c) -> ((a, b) -> c) uncurry f p             =  f (fst p) (snd p)  -- | Swap the components of a pair. swap                    :: (a,b) -> (b,a) swap (a,b)              = (b,a)++-- $setup+-- >>> import Prelude hiding (curry, uncurry, fst, snd)
Data/Type/Coercion.hs view
@@ -81,8 +81,7 @@ deriving instance Ord  (Coercion a b)  -- | @since 4.7.0.0-instance Coercible a b => Read (Coercion a b) where-  readsPrec d = readParen (d > 10) (\r -> [(Coercion, s) | ("Coercion",s) <- lex r ])+deriving instance Coercible a b => Read (Coercion a b)  -- | @since 4.7.0.0 instance Coercible a b => Enum (Coercion a b) where
Data/Type/Equality.hs view
@@ -4,14 +4,14 @@ {-# LANGUAGE FlexibleInstances      #-} {-# LANGUAGE StandaloneDeriving     #-} {-# LANGUAGE NoImplicitPrelude      #-}-{-# LANGUAGE PolyKinds              #-} {-# LANGUAGE RankNTypes             #-}-{-# LANGUAGE DataKinds              #-}+{-# LANGUAGE TypeInType             #-} {-# LANGUAGE TypeFamilies           #-} {-# LANGUAGE UndecidableInstances   #-} {-# LANGUAGE ExplicitNamespaces     #-} {-# LANGUAGE MultiParamTypeClasses  #-} {-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE TypeInType             #-} {-# LANGUAGE Trustworthy            #-}  -----------------------------------------------------------------------------@@ -125,8 +125,7 @@ deriving instance Ord  (a :~: b)  -- | @since 4.7.0.0-instance a ~ b => Read (a :~: b) where-  readsPrec d = readParen (d > 10) (\r -> [(Refl, s) | ("Refl",s) <- lex r ])+deriving instance a ~ b => Read (a :~: b)  -- | @since 4.7.0.0 instance a ~ b => Enum (a :~: b) where@@ -138,7 +137,7 @@ -- | @since 4.7.0.0 deriving instance a ~ b => Bounded (a :~: b) --- | Kind heterogeneous propositional equality. Like '(:~:)', @a :~~: b@ is+-- | Kind heterogeneous propositional equality. Like ':~:', @a :~~: b@ is -- inhabited by a terminating value if and only if @a@ is the same type as @b@. -- -- @since 4.10.0.0@@ -153,8 +152,7 @@ deriving instance Ord  (a :~~: b)  -- | @since 4.10.0.0-instance a ~~ b => Read (a :~~: b) where-  readsPrec d = readParen (d > 10) (\r -> [(HRefl, s) | ("HRefl",s) <- lex r ])+deriving instance a ~~ b => Read (a :~~: b)  -- | @since 4.10.0.0 instance a ~~ b => Enum (a :~~: b) where@@ -181,164 +179,47 @@ instance TestEquality ((:~~:) a) where   testEquality HRefl HRefl = Just Refl --- | A type family to compute Boolean equality. Instances are provided--- only for /open/ kinds, such as @*@ and function kinds. Instances are--- also provided for datatypes exported from base. A poly-kinded instance--- is /not/ provided, as a recursive definition for algebraic kinds is--- generally more useful.-type family (a :: k) == (b :: k) :: Bool infix 4 == -{--This comment explains more about why a poly-kinded instance for (==) is-not provided. To be concrete, here would be the poly-kinded instance:--type family EqPoly (a :: k) (b :: k) where- EqPoly a a = True- EqPoly a b = False-type instance (a :: k) == (b :: k) = EqPoly a b--Note that this overlaps with every other instance -- if this were defined,-it would be the only instance for (==).--Now, consider-data Nat = Zero | Succ Nat--Suppose I want-foo :: (Succ n == Succ m) ~ True => ((n == m) :~: True)-foo = Refl--This would not type-check with the poly-kinded instance. `Succ n == Succ m`-quickly becomes `EqPoly (Succ n) (Succ m)` but then is stuck. We don't know-enough about `n` and `m` to reduce further.--On the other hand, consider this:--type family EqNat (a :: Nat) (b :: Nat) where- EqNat Zero     Zero     = True- EqNat (Succ n) (Succ m) = EqNat n m- EqNat n        m        = False-type instance (a :: Nat) == (b :: Nat) = EqNat a b--With this instance, `foo` type-checks fine. `Succ n == Succ m` becomes `EqNat-(Succ n) (Succ m)` which becomes `EqNat n m`. Thus, we can conclude `(n == m)-~ True` as desired.--So, the Nat-specific instance allows strictly more reductions, and is thus-preferable to the poly-kinded instance. But, if we introduce the poly-kinded-instance, we are barred from writing the Nat-specific instance, due to-overlap.--Even better than the current instance for * would be one that does this sort-of recursion for all datatypes, something like this:--type family EqStar (a :: *) (b :: *) where- EqStar Bool Bool = True- EqStar (a,b) (c,d) = a == c && b == d- EqStar (Maybe a) (Maybe b) = a == b- ...- EqStar a b = False--The problem is the (...) is extensible -- we would want to add new cases for-all datatypes in scope. This is not currently possible for closed type-families.--}---- all of the following closed type families are local to this module-type family EqStar (a :: *) (b :: *) where-  EqStar a a = 'True-  EqStar a b = 'False---- This looks dangerous, but it isn't. This allows == to be defined--- over arbitrary type constructors.-type family EqArrow (a :: k1 -> k2) (b :: k1 -> k2) where-  EqArrow a a = 'True-  EqArrow a b = 'False--type family EqBool a b where-  EqBool 'True  'True  = 'True-  EqBool 'False 'False = 'True-  EqBool a      b      = 'False--type family EqOrdering a b where-  EqOrdering 'LT 'LT = 'True-  EqOrdering 'EQ 'EQ = 'True-  EqOrdering 'GT 'GT = 'True-  EqOrdering a   b   = 'False--type EqUnit (a :: ()) (b :: ()) = 'True--type family EqList a b where-  EqList '[]        '[]        = 'True-  EqList (h1 ': t1) (h2 ': t2) = (h1 == h2) && (t1 == t2)-  EqList a          b          = 'False--type family EqMaybe a b where-  EqMaybe 'Nothing   'Nothing  = 'True-  EqMaybe ('Just x) ('Just y)  = x == y-  EqMaybe a         b          = 'False--type family Eq2 a b where-  Eq2 '(a1, b1) '(a2, b2) = a1 == a2 && b1 == b2--type family Eq3 a b where-  Eq3 '(a1, b1, c1) '(a2, b2, c2) = a1 == a2 && b1 == b2 && c1 == c2--type family Eq4 a b where-  Eq4 '(a1, b1, c1, d1) '(a2, b2, c2, d2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2--type family Eq5 a b where-  Eq5 '(a1, b1, c1, d1, e1) '(a2, b2, c2, d2, e2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2--type family Eq6 a b where-  Eq6 '(a1, b1, c1, d1, e1, f1) '(a2, b2, c2, d2, e2, f2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2--type family Eq7 a b where-  Eq7 '(a1, b1, c1, d1, e1, f1, g1) '(a2, b2, c2, d2, e2, f2, g2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2--type family Eq8 a b where-  Eq8 '(a1, b1, c1, d1, e1, f1, g1, h1) '(a2, b2, c2, d2, e2, f2, g2, h2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2 && h1 == h2--type family Eq9 a b where-  Eq9 '(a1, b1, c1, d1, e1, f1, g1, h1, i1) '(a2, b2, c2, d2, e2, f2, g2, h2, i2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2 && h1 == h2 && i1 == i2--type family Eq10 a b where-  Eq10 '(a1, b1, c1, d1, e1, f1, g1, h1, i1, j1) '(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2 && h1 == h2 && i1 == i2 && j1 == j2--type family Eq11 a b where-  Eq11 '(a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1) '(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2 && h1 == h2 && i1 == i2 && j1 == j2 && k1 == k2--type family Eq12 a b where-  Eq12 '(a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1) '(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2 && h1 == h2 && i1 == i2 && j1 == j2 && k1 == k2 && l1 == l2--type family Eq13 a b where-  Eq13 '(a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1) '(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2 && h1 == h2 && i1 == i2 && j1 == j2 && k1 == k2 && l1 == l2 && m1 == m2--type family Eq14 a b where-  Eq14 '(a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1) '(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2 && h1 == h2 && i1 == i2 && j1 == j2 && k1 == k2 && l1 == l2 && m1 == m2 && n1 == n2--type family Eq15 a b where-  Eq15 '(a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1) '(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2) = a1 == a2 && b1 == b2 && c1 == c2 && d1 == d2 && e1 == e2 && f1 == f2 && g1 == g2 && h1 == h2 && i1 == i2 && j1 == j2 && k1 == k2 && l1 == l2 && m1 == m2 && n1 == n2 && o1 == o2+-- | A type family to compute Boolean equality.+type family (a :: k) == (b :: k) :: Bool where+  f a == g b = f == g && a == b+  a == a = 'True+  _ == _ = 'False --- these all look to be overlapping, but they are differentiated by their kinds-type instance a == b = EqStar a b-type instance a == b = EqArrow a b-type instance a == b = EqBool a b-type instance a == b = EqOrdering a b-type instance a == b = EqUnit a b-type instance a == b = EqList a b-type instance a == b = EqMaybe a b-type instance a == b = Eq2 a b-type instance a == b = Eq3 a b-type instance a == b = Eq4 a b-type instance a == b = Eq5 a b-type instance a == b = Eq6 a b-type instance a == b = Eq7 a b-type instance a == b = Eq8 a b-type instance a == b = Eq9 a b-type instance a == b = Eq10 a b-type instance a == b = Eq11 a b-type instance a == b = Eq12 a b-type instance a == b = Eq13 a b-type instance a == b = Eq14 a b-type instance a == b = Eq15 a b+-- The idea here is to recognize equality of *applications* using+-- the first case, and of *constructors* using the second and third+-- ones. It would be wonderful if GHC recognized that the+-- first and second cases are compatible, which would allow us to+-- prove+--+-- a ~ b => a == b+--+-- but it (understandably) does not.+--+-- It is absolutely critical that the three cases occur in precisely+-- this order. In particular, if+--+-- a == a = 'True+--+-- came first, then the type application case would only be reached+-- (uselessly) when GHC discovered that the types were not equal.+--+-- One might reasonably ask what's wrong with a simpler version:+--+-- type family (a :: k) == (b :: k) where+--  a == a = True+--  a == b = False+--+-- Consider+-- data Nat = Zero | Succ Nat+--+-- Suppose I want+-- foo :: (Succ n == Succ m) ~ True => ((n == m) :~: True)+-- foo = Refl+--+-- This would not type-check with the simple version. `Succ n == Succ m`+-- is stuck. We don't know enough about `n` and `m` to reduce the family.+-- With the recursive version, `Succ n == Succ m` reduces to+-- `Succ == Succ && n == m`, which can reduce to `'True && n == m` and+-- finally to `n == m`.
Data/Typeable.hs view
@@ -86,8 +86,6 @@        -- * For backwards compatibility     , typeOf1, typeOf2, typeOf3, typeOf4, typeOf5, typeOf6, typeOf7-    , Typeable1, Typeable2, Typeable3, Typeable4-    , Typeable5, Typeable6, Typeable7     ) where  import qualified Data.Typeable.Internal as I@@ -225,19 +223,3 @@ typeOf7 :: forall t (a :: *) (b :: *) (c :: *) (d :: *) (e :: *) (f :: *)                 (g :: *). Typeable t => t a b c d e f g -> TypeRep typeOf7 _ = I.someTypeRep (Proxy :: Proxy t)--type Typeable1 (a :: * -> *)                               = Typeable a-type Typeable2 (a :: * -> * -> *)                          = Typeable a-type Typeable3 (a :: * -> * -> * -> *)                     = Typeable a-type Typeable4 (a :: * -> * -> * -> * -> *)                = Typeable a-type Typeable5 (a :: * -> * -> * -> * -> * -> *)           = Typeable a-type Typeable6 (a :: * -> * -> * -> * -> * -> * -> *)      = Typeable a-type Typeable7 (a :: * -> * -> * -> * -> * -> * -> * -> *) = Typeable a--{-# DEPRECATED Typeable1 "renamed to 'Typeable'" #-} -- deprecated in 7.8-{-# DEPRECATED Typeable2 "renamed to 'Typeable'" #-} -- deprecated in 7.8-{-# DEPRECATED Typeable3 "renamed to 'Typeable'" #-} -- deprecated in 7.8-{-# DEPRECATED Typeable4 "renamed to 'Typeable'" #-} -- deprecated in 7.8-{-# DEPRECATED Typeable5 "renamed to 'Typeable'" #-} -- deprecated in 7.8-{-# DEPRECATED Typeable6 "renamed to 'Typeable'" #-} -- deprecated in 7.8-{-# DEPRECATED Typeable7 "renamed to 'Typeable'" #-} -- deprecated in 7.8
Data/Typeable/Internal.hs view
@@ -18,6 +18,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-}  ----------------------------------------------------------------------------- -- |@@ -75,7 +76,7 @@      -- * Construction     -- | These are for internal use only-    mkTrCon, mkTrApp, mkTrFun,+    mkTrType, mkTrCon, mkTrApp, mkTrAppChecked, mkTrFun,     mkTyCon, mkTyCon#,     typeSymbolTypeRep, typeNatTypeRep,   ) where@@ -87,7 +88,7 @@ import GHC.List ( splitAt, foldl' ) import GHC.Word import GHC.Show-import GHC.TypeLits ( KnownSymbol, symbolVal' )+import GHC.TypeLits ( KnownSymbol, symbolVal', AppendSymbol ) import GHC.TypeNats ( KnownNat, natVal' ) import Unsafe.Coerce ( unsafeCoerce ) @@ -97,6 +98,7 @@    -- Better to break the loop here, because we want non-SOURCE imports    -- of Data.Typeable as much as possible so we can optimise the derived    -- instances.+-- import {-# SOURCE #-} Debug.Trace (trace)  #include "MachDeps.h" @@ -178,20 +180,111 @@ -- | A concrete representation of a (monomorphic) type. -- 'TypeRep' supports reasonably efficient equality. data TypeRep (a :: k) where-    TrTyCon :: {-# UNPACK #-} !Fingerprint -> !TyCon -> [SomeTypeRep]+    -- The TypeRep of Type. See Note [Kind caching], Wrinkle 2+    TrType :: TypeRep Type+    TrTyCon :: { -- See Note [TypeRep fingerprints]+                 trTyConFingerprint :: {-# UNPACK #-} !Fingerprint++                 -- The TypeRep represents the application of trTyCon+                 -- to the kind arguments trKindVars. So for+                 -- 'Just :: Bool -> Maybe Bool, the trTyCon will be+                 -- 'Just and the trKindVars will be [Bool].+               , trTyCon :: !TyCon+               , trKindVars :: [SomeTypeRep]+               , trTyConKind :: !(TypeRep k) }  -- See Note [Kind caching]             -> TypeRep (a :: k)++    -- | Invariant: Saturated arrow types (e.g. things of the form @a -> b@)+    -- are represented with @'TrFun' a b@, not @TrApp (TrApp funTyCon a) b@.     TrApp   :: forall k1 k2 (a :: k1 -> k2) (b :: k1).-               {-# UNPACK #-} !Fingerprint-            -> TypeRep (a :: k1 -> k2)-            -> TypeRep (b :: k1)+               { -- See Note [TypeRep fingerprints]+                 trAppFingerprint :: {-# UNPACK #-} !Fingerprint++                 -- The TypeRep represents the application of trAppFun+                 -- to trAppArg. For Maybe Int, the trAppFun will be Maybe+                 -- and the trAppArg will be Int.+               , trAppFun :: !(TypeRep (a :: k1 -> k2))+               , trAppArg :: !(TypeRep (b :: k1))+               , trAppKind :: !(TypeRep k2) }   -- See Note [Kind caching]             -> TypeRep (a b)++    -- | @TrFun fpr a b@ represents a function type @a -> b@. We use this for+    -- the sake of efficiency as functions are quite ubiquitous.     TrFun   :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)                       (a :: TYPE r1) (b :: TYPE r2).-               {-# UNPACK #-} !Fingerprint-            -> TypeRep a-            -> TypeRep b+               { -- See Note [TypeRep fingerprints]+                 trFunFingerprint :: {-# UNPACK #-} !Fingerprint++                 -- The TypeRep represents a function from trFunArg to+                 -- trFunRes.+               , trFunArg :: !(TypeRep a)+               , trFunRes :: !(TypeRep b) }             -> TypeRep (a -> b) +{- Note [TypeRep fingerprints]+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~+We store a Fingerprint of each TypeRep in its constructor. This allows+us to test whether two TypeReps are equal in constant time, rather than+having to walk their full structures.+-}++{- Note [Kind caching]+   ~~~~~~~~~~~~~~~~~~~++We cache the kind of the TypeRep in each TrTyCon and TrApp constructor.+This is necessary to ensure that typeRepKind (which is used, at least, in+deserialization and dynApply) is cheap. There are two reasons for this:++1. Calculating the kind of a nest of type applications, such as++  F X Y Z W   (App (App (App (App F X) Y) Z) W)++is linear in the depth, which is already a bit pricy. In deserialization,+we build up such a nest from the inside out, so without caching, that ends+up taking quadratic time, and calculating the KindRep of the constructor,+F, a linear number of times. See #14254.++2. Calculating the kind of a type constructor, in instantiateTypeRep,+requires building (allocating) a TypeRep for the kind "from scratch".+This can get pricy. When combined with point (1), we can end up with+a large amount of extra allocation deserializing very deep nests.+See #14337.++It is quite possible to speed up deserialization by structuring that process+very carefully. Unfortunately, that doesn't help dynApply or anything else+that may use typeRepKind. Since caching the kind isn't terribly expensive, it+seems better to just do that and solve all the potential problems at once.++There are two things we need to be careful about when caching kinds.++Wrinkle 1:++We want to do it eagerly. Suppose we have++  tf :: TypeRep (f :: j -> k)+  ta :: TypeRep (a :: j)++Then the cached kind of App tf ta should be eagerly evaluated to k, rather+than being stored as a thunk that will strip the (j ->) off of j -> k if+and when it is forced.++Wrinkle 2:++We need to be able to represent TypeRep Type. This is a bit tricky because+typeRepKind (typeRep @Type) = typeRep @Type, so if we actually cache the+typerep of the kind of Type, we will have a loop. One simple way to do this+is to make the cached kind fields lazy and allow TypeRep Type to be cyclical.++But we *do not* want TypeReps to have cyclical structure! Most importantly,+a cyclical structure cannot be stored in a compact region. Secondarily,+using :force in GHCi on a cyclical structure will lead to non-termination.++To avoid this trouble, we use a separate constructor for TypeRep Type.+mkTrApp is responsible for recognizing that TYPE is being applied to+'LiftedRep and produce trType; other functions must recognize that TrType+represents an application.+-}+ -- Compare keys for equality  -- | @since 2.01@@ -229,6 +322,7 @@ -- | The function type constructor. -- -- For instance,+-- -- @ -- typeRep \@(Int -> Char) === Fun (typeRep \@Int) (typeRep \@Char) -- @@@ -240,90 +334,217 @@             => TypeRep arg             -> TypeRep res             -> TypeRep fun-pattern Fun arg res <- TrFun _ arg res+pattern Fun arg res <- TrFun {trFunArg = arg, trFunRes = res}   where Fun arg res = mkTrFun arg res  -- | Observe the 'Fingerprint' of a type representation -- -- @since 4.8.0.0 typeRepFingerprint :: TypeRep a -> Fingerprint-typeRepFingerprint (TrTyCon fpr _ _) = fpr-typeRepFingerprint (TrApp fpr _ _) = fpr-typeRepFingerprint (TrFun fpr _ _) = fpr+typeRepFingerprint TrType = fpTYPELiftedRep+typeRepFingerprint (TrTyCon {trTyConFingerprint = fpr}) = fpr+typeRepFingerprint (TrApp {trAppFingerprint = fpr}) = fpr+typeRepFingerprint (TrFun {trFunFingerprint = fpr}) = fpr +-- For compiler use+mkTrType :: TypeRep Type+mkTrType = TrType+ -- | Construct a representation for a type constructor -- applied at a monomorphic kind. -- -- Note that this is unsafe as it allows you to construct -- ill-kinded types. mkTrCon :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a-mkTrCon tc kind_vars = TrTyCon fpr tc kind_vars+mkTrCon tc kind_vars = TrTyCon+    { trTyConFingerprint = fpr+    , trTyCon = tc+    , trKindVars = kind_vars+    , trTyConKind = kind }   where     fpr_tc  = tyConFingerprint tc     fpr_kvs = map someTypeRepFingerprint kind_vars     fpr     = fingerprintFingerprints (fpr_tc:fpr_kvs)+    kind    = unsafeCoerceRep $ tyConKind tc kind_vars --- | Construct a representation for a type application.---+-- The fingerprint of Type. We don't store this in the TrType+-- constructor, so we need to build it here.+fpTYPELiftedRep :: Fingerprint+fpTYPELiftedRep = fingerprintFingerprints+      [tyConFingerprint tyConTYPE, typeRepFingerprint trLiftedRep]+-- There is absolutely nothing to gain and everything to lose+-- by inlining the worker. The wrapper should inline anyway.+{-# NOINLINE fpTYPELiftedRep #-}++trTYPE :: TypeRep TYPE+trTYPE = typeRep++trLiftedRep :: TypeRep 'LiftedRep+trLiftedRep = typeRep++-- | Construct a representation for a type application that is+-- NOT a saturated arrow type. This is not checked!+ -- Note that this is known-key to the compiler, which uses it in desugar -- 'Typeable' evidence. mkTrApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1).            TypeRep (a :: k1 -> k2)         -> TypeRep (b :: k1)         -> TypeRep (a b)-mkTrApp a b = TrApp fpr a b+mkTrApp a b -- See Note [Kind caching], Wrinkle 2+  | Just HRefl <- a `eqTypeRep` trTYPE+  , Just HRefl <- b `eqTypeRep` trLiftedRep+  = TrType++  | TrFun {trFunRes = res_kind} <- typeRepKind a+  = TrApp+    { trAppFingerprint = fpr+    , trAppFun = a+    , trAppArg = b+    , trAppKind = res_kind }++  | otherwise = error ("Ill-kinded type application: "+                           ++ show (typeRepKind a))   where     fpr_a = typeRepFingerprint a     fpr_b = typeRepFingerprint b     fpr   = fingerprintFingerprints [fpr_a, fpr_b] +-- | Construct a representation for a type application that+-- may be a saturated arrow type. This is renamed to mkTrApp in+-- Type.Reflection.Unsafe+mkTrAppChecked :: forall k1 k2 (a :: k1 -> k2) (b :: k1).+                  TypeRep (a :: k1 -> k2)+               -> TypeRep (b :: k1)+               -> TypeRep (a b)+mkTrAppChecked rep@(TrApp {trAppFun = p, trAppArg = x :: TypeRep x})+               (y :: TypeRep y)+  | TrTyCon {trTyCon=con} <- p+  , con == funTyCon  -- cheap check first+  , Just (IsTYPE (rx :: TypeRep rx)) <- isTYPE (typeRepKind x)+  , Just (IsTYPE (ry :: TypeRep ry)) <- isTYPE (typeRepKind y)+  , Just HRefl <- withTypeable x $ withTypeable rx $ withTypeable ry+                  $ typeRep @((->) x :: TYPE ry -> Type) `eqTypeRep` rep+  = mkTrFun x y+mkTrAppChecked a b = mkTrApp a b+ -- | A type application. -- -- For instance,+-- -- @ -- typeRep \@(Maybe Int) === App (typeRep \@Maybe) (typeRep \@Int) -- @--- Note that this will never match a function type (e.g. @Int -> Char@). --+-- Note that this will also match a function type,+--+-- @+-- typeRep \@(Int# -> Char)+--   ===+-- App (App arrow (typeRep \@Int#)) (typeRep \@Char)+-- @+--+-- where @arrow :: TypeRep ((->) :: TYPE IntRep -> Type -> Type)@.+-- pattern App :: forall k2 (t :: k2). ()             => forall k1 (a :: k1 -> k2) (b :: k1). (t ~ a b)             => TypeRep a -> TypeRep b -> TypeRep t-pattern App f x <- TrApp _ f x-  where App f x = mkTrApp f x+pattern App f x <- (splitApp -> IsApp f x)+  where App f x = mkTrAppChecked f x +data AppOrCon (a :: k) where+    IsApp :: forall k k' (f :: k' -> k) (x :: k'). ()+          => TypeRep f -> TypeRep x -> AppOrCon (f x)+    -- See Note [Con evidence]+    IsCon :: IsApplication a ~ "" => TyCon -> [SomeTypeRep] -> AppOrCon a++type family IsApplication (x :: k) :: Symbol where+  IsApplication (_ _) = "An error message about this unifying with \"\" "+     `AppendSymbol` "means that you tried to match a TypeRep with Con or "+     `AppendSymbol` "Con' when the represented type was known to be an "+     `AppendSymbol` "application."+  IsApplication _ = ""++splitApp :: forall k (a :: k). ()+         => TypeRep a+         -> AppOrCon a+splitApp TrType = IsApp trTYPE trLiftedRep+splitApp (TrApp {trAppFun = f, trAppArg = x}) = IsApp f x+splitApp rep@(TrFun {trFunArg=a, trFunRes=b}) = IsApp (mkTrApp arr a) b+  where arr = bareArrow rep+splitApp (TrTyCon{trTyCon = con, trKindVars = kinds})+  = case unsafeCoerce Refl :: IsApplication a :~: "" of+      Refl -> IsCon con kinds+ -- | Use a 'TypeRep' as 'Typeable' evidence.-withTypeable :: forall a r. TypeRep a -> (Typeable a => r) -> r+withTypeable :: forall (a :: k) (r :: TYPE rep). ()+             => TypeRep a -> (Typeable a => r) -> r withTypeable rep k = unsafeCoerce k' rep   where k' :: Gift a r         k' = Gift k  -- | A helper to satisfy the type checker in 'withTypeable'.-newtype Gift a r = Gift (Typeable a => r)+newtype Gift a (r :: TYPE rep) = Gift (Typeable a => r)  -- | Pattern match on a type constructor-pattern Con :: forall k (a :: k). TyCon -> TypeRep a-pattern Con con <- TrTyCon _ con _+pattern Con :: forall k (a :: k). ()+            => IsApplication a ~ "" -- See Note [Con evidence]+            => TyCon -> TypeRep a+pattern Con con <- (splitApp -> IsCon con _)  -- | Pattern match on a type constructor including its instantiated kind -- variables. -- -- For instance,+-- -- @ -- App (Con' proxyTyCon ks) intRep = typeRep @(Proxy \@Int) -- @+-- -- will bring into scope,+-- -- @ -- proxyTyCon :: TyCon -- ks         == [someTypeRep @Type] :: [SomeTypeRep] -- intRep     == typeRep @Int -- @ ---pattern Con' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a-pattern Con' con ks <- TrTyCon _ con ks+pattern Con' :: forall k (a :: k). ()+             => IsApplication a ~ "" -- See Note [Con evidence]+             => TyCon -> [SomeTypeRep] -> TypeRep a+pattern Con' con ks <- (splitApp -> IsCon con ks) +-- TODO: Remove Fun when #14253 is fixed {-# COMPLETE Fun, App, Con  #-} {-# COMPLETE Fun, App, Con' #-} +{- Note [Con evidence]+    ~~~~~~~~~~~~~~~~~~~++Matching TypeRep t on Con or Con' fakes up evidence that++  IsApplication t ~ "".++Why should anyone care about the value of strange internal type family?+Well, almost nobody cares about it, but the pattern checker does!+For example, suppose we have TypeRep (f x) and we want to get+TypeRep f and TypeRep x. There is no chance that the Con constructor+will match, because (f x) is not a constructor, but without the+IsApplication evidence, omitting it will lead to an incomplete pattern+warning. With the evidence, the pattern checker will see that+Con wouldn't typecheck, so everything works out as it should.++Why do we use Symbols? We would really like to use something like++  type family NotApplication (t :: k) :: Constraint where+    NotApplication (f a) = TypeError ...+    NotApplication _ = ()++Unfortunately, #11503 means that the pattern checker and type checker+will fail to actually reject the mistaken patterns. So we describe the+error in the result type. It's a horrible hack.+-}+ ----------------- Observation ---------------------  -- | Observe the type constructor of a quantified type representation.@@ -332,9 +553,10 @@  -- | Observe the type constructor of a type representation typeRepTyCon :: TypeRep a -> TyCon-typeRepTyCon (TrTyCon _ tc _) = tc-typeRepTyCon (TrApp _ a _)    = typeRepTyCon a-typeRepTyCon (TrFun _ _ _)    = typeRepTyCon $ typeRep @(->)+typeRepTyCon TrType = tyConTYPE+typeRepTyCon (TrTyCon {trTyCon = tc}) = tc+typeRepTyCon (TrApp {trAppFun = a})   = typeRepTyCon a+typeRepTyCon (TrFun {})               = typeRepTyCon $ typeRep @(->)  -- | Type equality --@@ -354,14 +576,10 @@  -- | Observe the kind of a type. typeRepKind :: TypeRep (a :: k) -> TypeRep k-typeRepKind (TrTyCon _ tc args)-  = unsafeCoerceRep $ tyConKind tc args-typeRepKind (TrApp _ f _)-  | Fun _ res <- typeRepKind f-  = res-  | otherwise-  = error ("Ill-kinded type application: " ++ show (typeRepKind f))-typeRepKind (TrFun _ _ _) = typeRep @Type+typeRepKind TrType = TrType+typeRepKind (TrTyCon {trTyConKind = kind}) = kind+typeRepKind (TrApp {trAppKind = kind}) = kind+typeRepKind (TrFun {}) = typeRep @Type  tyConKind :: TyCon -> [SomeTypeRep] -> SomeTypeRep tyConKind (TyCon _ _ _ _ nKindVars# kindRep) kindVars =@@ -382,14 +600,15 @@             applyTy :: SomeTypeRep -> KindRep -> SomeTypeRep             applyTy (SomeTypeRep acc) ty               | SomeTypeRep ty' <- go ty-              = SomeTypeRep $ mkTrApp (unsafeCoerce acc) (unsafeCoerce ty')+              = SomeTypeRep $ mkTrApp (unsafeCoerce acc) ty'         in foldl' applyTy tycon_app ty_args     go (KindRepVar var)       = vars A.! var     go (KindRepApp f a)-      = SomeTypeRep $ App (unsafeCoerceRep $ go f) (unsafeCoerceRep $ go a)+      = SomeTypeRep $ mkTrApp (unsafeCoerceRep $ go f) (unsafeCoerceRep $ go a)     go (KindRepFun a b)-      = SomeTypeRep $ Fun (unsafeCoerceRep $ go a) (unsafeCoerceRep $ go b)+      = SomeTypeRep $ mkTrFun (unsafeCoerceRep $ go a) (unsafeCoerceRep $ go b)+    go (KindRepTYPE LiftedRep) = SomeTypeRep TrType     go (KindRepTYPE r) = unkindedTypeRep $ tYPE `kApp` runtimeRepTypeRep r     go (KindRepTypeLitS sort s)       = mkTypeLitFromString sort (unpackCStringUtf8# s)@@ -412,7 +631,7 @@      -> SomeKindedTypeRep k      -> SomeKindedTypeRep k' kApp (SomeKindedTypeRep f) (SomeKindedTypeRep a) =-    SomeKindedTypeRep (App f a)+    SomeKindedTypeRep (mkTrApp f a)  kindedTypeRep :: forall (a :: k). Typeable a => SomeKindedTypeRep k kindedTypeRep = SomeKindedTypeRep (typeRep @a)@@ -478,6 +697,34 @@     rep :: forall (a :: VecElem). Typeable a => SomeKindedTypeRep VecElem     rep = kindedTypeRep @VecElem @a +bareArrow :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)+                    (a :: TYPE r1) (b :: TYPE r2). ()+          => TypeRep (a -> b)+          -> TypeRep ((->) :: TYPE r1 -> TYPE r2 -> Type)+bareArrow (TrFun _ a b) =+    mkTrCon funTyCon [SomeTypeRep rep1, SomeTypeRep rep2]+  where+    rep1 = getRuntimeRep $ typeRepKind a :: TypeRep r1+    rep2 = getRuntimeRep $ typeRepKind b :: TypeRep r2+bareArrow _ = error "Data.Typeable.Internal.bareArrow: impossible"++data IsTYPE (a :: Type) where+    IsTYPE :: forall (r :: RuntimeRep). TypeRep r -> IsTYPE (TYPE r)++-- | Is a type of the form @TYPE rep@?+isTYPE :: TypeRep (a :: Type) -> Maybe (IsTYPE a)+isTYPE TrType = Just (IsTYPE trLiftedRep)+isTYPE (TrApp {trAppFun=f, trAppArg=r})+  | Just HRefl <- f `eqTypeRep` typeRep @TYPE+  = Just (IsTYPE r)+isTYPE _ = Nothing++getRuntimeRep :: forall (r :: RuntimeRep). TypeRep (TYPE r) -> TypeRep r+getRuntimeRep TrType = trLiftedRep+getRuntimeRep (TrApp {trAppArg=r}) = r+getRuntimeRep _ = error "Data.Typeable.Internal.getRuntimeRep: impossible"++ ------------------------------------------------------------- -- --      The Typeable class and friends@@ -515,25 +762,24 @@   showTypeable :: Int -> TypeRep (a :: k) -> ShowS+showTypeable _ TrType = showChar '*' showTypeable _ rep-  | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) =-    showChar '*'   | isListTyCon tc, [ty] <- tys =     showChar '[' . shows ty . showChar ']'   | isTupleTyCon tc =     showChar '(' . showArgs (showChar ',') tys . showChar ')'   where (tc, tys) = splitApps rep-showTypeable p (TrTyCon _ tycon [])+showTypeable p (TrTyCon {trTyCon = tycon, trKindVars = []})   = showsPrec p tycon-showTypeable p (TrTyCon _ tycon args)+showTypeable p (TrTyCon {trTyCon = tycon, trKindVars = args})   = showParen (p > 9) $     showsPrec p tycon .     showChar ' ' .     showArgs (showChar ' ') args-showTypeable p (TrFun _ x r)+showTypeable p (TrFun {trFunArg = x, trFunRes = r})   = showParen (p > 8) $     showsPrec 9 x . showString " -> " . showsPrec 8 r-showTypeable p (TrApp _ f x)+showTypeable p (TrApp {trAppFun = f, trAppArg = x})   = showParen (p > 9) $     showsPrec 8 f .     showChar ' ' .@@ -547,17 +793,40 @@ splitApps = go []   where     go :: [SomeTypeRep] -> TypeRep a -> (TyCon, [SomeTypeRep])-    go xs (TrTyCon _ tc _) = (tc, xs)-    go xs (TrApp _ f x)    = go (SomeTypeRep x : xs) f-    go [] (TrFun _ a b)    = (funTyCon, [SomeTypeRep a, SomeTypeRep b])-    go _  (TrFun _ _ _)    =-        errorWithoutStackTrace "Data.Typeable.Internal.splitApps: Impossible"+    go xs (TrTyCon {trTyCon = tc})+      = (tc, xs)+    go xs (TrApp {trAppFun = f, trAppArg = x})+      = go (SomeTypeRep x : xs) f+    go [] (TrFun {trFunArg = a, trFunRes = b})+      = (funTyCon, [SomeTypeRep a, SomeTypeRep b])+    go _  (TrFun {})+      = errorWithoutStackTrace "Data.Typeable.Internal.splitApps: Impossible 1"+    go [] TrType = (tyConTYPE, [SomeTypeRep trLiftedRep])+    go _ TrType+      = errorWithoutStackTrace "Data.Typeable.Internal.splitApps: Impossible 2" +-- This is incredibly shady! We don't really want to do this here; we+-- should really have the compiler reveal the TYPE TyCon directly+-- somehow. We need to construct this by hand because otherwise+-- we end up with horrible and somewhat mysterious loops trying to calculate+-- typeRep @TYPE. For the moment, we use the fact that we can get the proper+-- name of the ghc-prim package from the TyCon of LiftedRep (which we can+-- produce a TypeRep for without difficulty), and then just substitute in the+-- appropriate module and constructor names.+--+-- The ticket to find a better way to deal with this is+-- Trac #14480.+tyConTYPE :: TyCon+tyConTYPE = mkTyCon (tyConPackage liftedRepTyCon) "GHC.Prim" "TYPE" 0+       (KindRepFun (KindRepTyConApp liftedRepTyCon []) (KindRepTYPE LiftedRep))+  where+    liftedRepTyCon = typeRepTyCon (typeRep @RuntimeRep)+ funTyCon :: TyCon funTyCon = typeRepTyCon (typeRep @(->))  isListTyCon :: TyCon -> Bool-isListTyCon tc = tc == typeRepTyCon (typeRep :: TypeRep [Int])+isListTyCon tc = tc == typeRepTyCon (typeRep :: TypeRep [])  isTupleTyCon :: TyCon -> Bool isTupleTyCon tc@@ -573,9 +842,11 @@ -- -- @since 4.8.0.0 rnfTypeRep :: TypeRep a -> ()-rnfTypeRep (TrTyCon _ tyc _) = rnfTyCon tyc-rnfTypeRep (TrApp _ f x)     = rnfTypeRep f `seq` rnfTypeRep x-rnfTypeRep (TrFun _ x y)     = rnfTypeRep x `seq` rnfTypeRep y+-- The TypeRep structure is almost entirely strict by definition. The+-- fingerprinting and strict kind caching ensure that everything+-- else is forced anyway. So we don't need to do anything special+-- to reduce to normal form.+rnfTypeRep !_ = ()  -- | Helper to fully evaluate 'SomeTypeRep' for use as @NFData(rnf)@ -- implementation@@ -687,7 +958,10 @@ mkTrFun :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)                   (a :: TYPE r1) (b :: TYPE r2).            TypeRep a -> TypeRep b -> TypeRep ((a -> b) :: Type)-mkTrFun arg res = TrFun fpr arg res+mkTrFun arg res = TrFun+    { trFunFingerprint = fpr+    , trFunArg = arg+    , trFunRes = res }   where fpr = fingerprintFingerprints [ typeRepFingerprint arg                                       , typeRepFingerprint res] 
Data/Unique.hs view
@@ -6,7 +6,7 @@ -- Module      :  Data.Unique -- Copyright   :  (c) The University of Glasgow 2001 -- License     :  BSD-style (see the file libraries/base/LICENSE)--- +-- -- Maintainer  :  libraries@haskell.org -- Stability   :  experimental -- Portability :  non-portable@@ -30,6 +30,15 @@  -- | An abstract unique object.  Objects of type 'Unique' may be -- compared for equality and ordering and hashed into 'Int'.+--+-- >>> :{+-- do x <- newUnique+--    print (x == x)+--    y <- newUnique+--    print (x == y)+-- :}+-- True+-- False newtype Unique = Unique Integer deriving (Eq,Ord)  uniqSource :: IORef Integer
Data/Void.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE EmptyCase #-}+{-# LANGUAGE EmptyDataDeriving #-} {-# LANGUAGE Safe #-} {-# LANGUAGE StandaloneDeriving #-} @@ -28,31 +29,22 @@ import Data.Data import Data.Ix import GHC.Generics+import Data.Semigroup (Semigroup(..), stimesIdempotent)  -- | Uninhabited data type -- -- @since 4.8.0.0-data Void deriving (Generic)--deriving instance Data Void---- | @since 4.8.0.0-instance Eq Void where-    _ == _ = True---- | @since 4.8.0.0-instance Ord Void where-    compare _ _ = EQ---- | Reading a 'Void' value is always a parse error, considering--- 'Void' as a data type with no constructors.--- | @since 4.8.0.0-instance Read Void where-    readsPrec _ _ = []---- | @since 4.8.0.0-instance Show Void where-    showsPrec _ = absurd+data Void deriving+  ( Eq      -- ^ @since 4.8.0.0+  , Data    -- ^ @since 4.8.0.0+  , Generic -- ^ @since 4.8.0.0+  , Ord     -- ^ @since 4.8.0.0+  , Read    -- ^ Reading a 'Void' value is always a parse error, considering+            -- 'Void' as a data type with no constructors.+            --+            -- @since 4.8.0.0+  , Show    -- ^ @since 4.8.0.0+  )  -- | @since 4.8.0.0 instance Ix Void where@@ -64,8 +56,21 @@ -- | @since 4.8.0.0 instance Exception Void +-- | @since 4.9.0.0+instance Semigroup Void where+    a <> _ = a+    stimes = stimesIdempotent+ -- | Since 'Void' values logically don't exist, this witnesses the -- logical reasoning tool of \"ex falso quodlibet\".+--+-- >>> let x :: Either Void Int; x = Right 5+-- >>> :{+-- case x of+--     Right r -> r+--     Left l  -> absurd l+-- :}+-- 5 -- -- @since 4.8.0.0 absurd :: Void -> a
Data/Word.hs view
@@ -6,7 +6,7 @@ -- Module      :  Data.Word -- Copyright   :  (c) The University of Glasgow 2001 -- License     :  BSD-style (see the file libraries/base/LICENSE)--- +-- -- Maintainer  :  libraries@haskell.org -- Stability   :  experimental -- Portability :  portable@@ -31,6 +31,7 @@         ) where  import GHC.Word+import GHC.Read () -- Need the `Read` instance for types defined in `GHC.Word`.  {- $notes @@ -55,6 +56,6 @@   of the type result in a zero result.  This is contrary to the   behaviour in C, which is undefined; a common interpretation is to   truncate the shift count to the width of the type, for example @1 \<\<-  32 == 1@ in some C implementations. +  32 == 1@ in some C implementations. -} 
Debug/Trace.hs view
@@ -55,6 +55,9 @@ import GHC.Stack import Data.List +-- $setup+-- >>> import Prelude+ -- $tracing -- -- The 'trace', 'traceShow' and 'traceIO' functions print messages to an output@@ -104,7 +107,10 @@  For example, this returns the value of @f x@ but first outputs the message. -> trace ("calling f with x = " ++ show x) (f x)+>>> let x = 123; f = show+>>> trace ("calling f with x = " ++ show x) (f x)+"calling f with x = 123+123"  The 'trace' function should /only/ be used for debugging, or for monitoring execution. The function is not referentially transparent: its type indicates@@ -119,6 +125,10 @@ {-| Like 'trace' but returns the message instead of a third value. +>>> traceId "hello"+"hello+hello"+ @since 4.7.0.0 -} traceId :: String -> String@@ -129,23 +139,26 @@  This makes it convenient for printing the values of interesting variables or expressions inside a function. For example here we print the value of the-variables @x@ and @z@:+variables @x@ and @y@: -> f x y =->     traceShow (x, z) $ result->   where->     z = ...->     ...+>>> let f x y = traceShow (x,y) (x + y) in f (1+2) 5+(3,5)+8+ -}-traceShow :: (Show a) => a -> b -> b+traceShow :: Show a => a -> b -> b traceShow = trace . show  {-| Like 'traceShow' but returns the shown value instead of a third value. +>>> traceShowId (1+2+3, "hello" ++ "world")+(6,"helloworld")+(6,"helloworld")+ @since 4.7.0.0 -}-traceShowId :: (Show a) => a -> a+traceShowId :: Show a => a -> a traceShowId a = trace (show a) a  {-|@@ -159,25 +172,37 @@ and the message would only be printed once.  If your monad is in 'MonadIO', @liftIO . traceIO@ may be a better option. -> ... = do->   x <- ...->   traceM $ "x: " ++ show x->   y <- ...->   traceM $ "y: " ++ show y+>>> :{+do+    x <- Just 3+    traceM ("x: " ++ show x)+    y <- pure 12+    traceM ("y: " ++ show y)+    pure (x*2 + y)+:}+x: 3+y: 12+Just 18  @since 4.7.0.0 -}-traceM :: (Applicative f) => String -> f ()+traceM :: Applicative f => String -> f () traceM string = trace string $ pure ()  {-| Like 'traceM', but uses 'show' on the argument to convert it to a 'String'. -> ... = do->   x <- ...->   traceShowM $ x->   y <- ...->   traceShowM $ x + y+>>> :{+do+    x <- Just 3+    traceShowM x+    y <- pure 12+    traceShowM y+    pure (x*2 + y)+:}+3+12+Just 18  @since 4.7.0.0 -}
+ Debug/Trace.hs-boot view
@@ -0,0 +1,76 @@+{-# LANGUAGE Unsafe #-}+{-# LANGUAGE MagicHash #-}+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE UnboxedTuples #-}++-- This boot file is necessary to allow GHC developers to+-- use trace facilities in those (relatively few) modules that Debug.Trace+-- itself depends on. It is also necessary to make DsMonad.pprRuntimeTrace+-- trace injections work in those modules.++-----------------------------------------------------------------------------+-- |+-- Module      :  Debug.Trace+-- Copyright   :  (c) The University of Glasgow 2001+-- License     :  BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer  :  libraries@haskell.org+-- Stability   :  provisional+-- Portability :  portable+--+-- Functions for tracing and monitoring execution.+--+-- These can be useful for investigating bugs or performance problems.+-- They should /not/ be used in production code.+--+-----------------------------------------------------------------------------++module Debug.Trace (+        -- * Tracing+        -- $tracing+        trace,+        traceId,+        traceShow,+        traceShowId,+        traceStack,+        traceIO,+        traceM,+        traceShowM,++        -- * Eventlog tracing+        -- $eventlog_tracing+        traceEvent,+        traceEventIO,++        -- * Execution phase markers+        -- $markers+        traceMarker,+        traceMarkerIO,+  ) where++import GHC.Base+import GHC.Show++traceIO :: String -> IO ()++trace :: String -> a -> a++traceId :: String -> String++traceShow :: Show a => a -> b -> b++traceShowId :: Show a => a -> a++traceM :: Applicative f => String -> f ()++traceShowM :: (Show a, Applicative f) => a -> f ()++traceStack :: String -> a -> a++traceEvent :: String -> a -> a++traceEventIO :: String -> IO ()++traceMarker :: String -> a -> a++traceMarkerIO :: String -> IO ()
Foreign/C/String.hs view
@@ -420,7 +420,7 @@ cWcharsToChars :: [CWchar] -> [Char] charsToCWchars :: [Char] -> [CWchar] -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)  -- On Windows, wchar_t is 16 bits wide and CWString uses the UTF-16 encoding. 
Foreign/ForeignPtr.hs view
@@ -15,6 +15,9 @@ -- Foreign Function Interface (FFI) and will usually be imported via -- the "Foreign" module. --+-- For non-portable support of Haskell finalizers, see the+-- "Foreign.Concurrent" module.+-- -----------------------------------------------------------------------------  module Foreign.ForeignPtr ( 
Foreign/Marshal/Alloc.hs view
@@ -123,19 +123,6 @@     doAlloca       :: Storable a' => a' -> (Ptr a' -> IO b') -> IO b'     doAlloca dummy  = allocaBytesAligned (sizeOf dummy) (alignment dummy) --- Note [NOINLINE for touch#]--- ~~~~~~~~~~~~~~~~~~~~~~~~~~--- Both allocaBytes and allocaBytesAligned use the touch#, which is notoriously--- fragile in the presence of simplification (see #14346). In particular, the--- simplifier may drop the continuation containing the touch# if it can prove--- that the action passed to allocaBytes will not return. The hack introduced to--- fix this for 8.2.2 is to mark allocaBytes as NOINLINE, ensuring that the--- simplifier can't see the divergence.------ These can be removed once #14375 is fixed, which suggests that we instead do--- away with touch# in favor of a primitive that will capture the scoping left--- implicit in the case of touch#.- -- |@'allocaBytes' n f@ executes the computation @f@, passing as argument -- a pointer to a temporarily allocated block of memory of @n@ bytes. -- The block of memory is sufficiently aligned for any of the basic@@ -154,8 +141,6 @@      case touch# barr# s3 of { s4 ->      (# s4, r #)   }}}}}--- See Note [NOINLINE for touch#]-{-# NOINLINE allocaBytes #-}  allocaBytesAligned :: Int -> Int -> (Ptr a -> IO b) -> IO b allocaBytesAligned (I# size) (I# align) action = IO $ \ s0 ->@@ -167,8 +152,6 @@      case touch# barr# s3 of { s4 ->      (# s4, r #)   }}}}}--- See Note [NOINLINE for touch#]-{-# NOINLINE allocaBytesAligned #-}  -- |Resize a memory area that was allocated with 'malloc' or 'mallocBytes' -- to the size needed to store values of type @b@.  The returned pointer
GHC/Base.hs view
@@ -129,6 +129,14 @@ import GHC.Tuple ()     -- Note [Depend on GHC.Tuple] import GHC.Integer ()   -- Note [Depend on GHC.Integer] +-- for 'class Semigroup'+import {-# SOURCE #-} GHC.Real (Integral)+import {-# SOURCE #-} Data.Semigroup.Internal ( stimesDefault+                                              , stimesMaybe+                                              , stimesList+                                              , stimesIdempotentMonoid+                                              )+ infixr 9  . infixr 5  ++ infixl 4  <$@@ -204,16 +212,53 @@ data  Maybe a  =  Nothing | Just a   deriving (Eq, Ord) +infixr 6 <>++-- | The class of semigroups (types with an associative binary operation).+--+-- Instances should satisfy the associativity law:+--+--  * @x '<>' (y '<>' z) = (x '<>' y) '<>' z@+--+-- @since 4.9.0.0+class Semigroup a where+        -- | An associative operation.+        (<>) :: a -> a -> a++        -- | Reduce a non-empty list with @\<\>@+        --+        -- The default definition should be sufficient, but this can be+        -- overridden for efficiency.+        --+        sconcat :: NonEmpty a -> a+        sconcat (a :| as) = go a as where+          go b (c:cs) = b <> go c cs+          go b []     = b++        -- | Repeat a value @n@ times.+        --+        -- Given that this works on a 'Semigroup' it is allowed to fail if+        -- you request 0 or fewer repetitions, and the default definition+        -- will do so.+        --+        -- By making this a member of the class, idempotent semigroups+        -- and monoids can upgrade this to execute in /O(1)/ by+        -- picking @stimes = 'stimesIdempotent'@ or @stimes =+        -- 'stimesIdempotentMonoid'@ respectively.+        stimes :: Integral b => b -> a -> a+        stimes = stimesDefault++ -- | The class of monoids (types with an associative binary operation that -- has an identity).  Instances should satisfy the following laws: -----  * @mappend mempty x = x@+--  * @x '<>' 'mempty' = x@ -----  * @mappend x mempty = x@+--  * @'mempty' '<>' x = x@ -----  * @mappend x (mappend y z) = mappend (mappend x y) z@+--  * @x '<>' (y '<>' z) = (x '<>' y) '<>' z@ ('Semigroup' law) -----  * @mconcat = 'foldr' mappend mempty@+--  * @'mconcat' = 'foldr' '(<>)' 'mempty'@ -- -- The method names refer to the monoid of lists under concatenation, -- but there are many other instances.@@ -222,27 +267,39 @@ -- e.g. both addition and multiplication on numbers. -- In such cases we often define @newtype@s and make those instances -- of 'Monoid', e.g. 'Sum' and 'Product'.--class Monoid a where+--+-- __NOTE__: 'Semigroup' is a superclass of 'Monoid' since /base-4.11.0.0/.+class Semigroup a => Monoid a where+        -- | Identity of 'mappend'         mempty  :: a-        -- ^ Identity of 'mappend'++        -- | An associative operation+        --+        -- __NOTE__: This method is redundant and has the default+        -- implementation @'mappend' = '(<>)'@ since /base-4.11.0.0/.         mappend :: a -> a -> a-        -- ^ An associative operation-        mconcat :: [a] -> a+        mappend = (<>)+        {-# INLINE mappend #-} -        -- ^ Fold a list using the monoid.+        -- | Fold a list using the monoid.+        --         -- For most types, the default definition for 'mconcat' will be         -- used, but the function is included in the class definition so         -- that an optimized version can be provided for specific types.-+        mconcat :: [a] -> a         mconcat = foldr mappend mempty +-- | @since 4.9.0.0+instance Semigroup [a] where+        (<>) = (++)+        {-# INLINE (<>) #-}++        stimes = stimesList+ -- | @since 2.01 instance Monoid [a] where         {-# INLINE mempty #-}         mempty  = []-        {-# INLINE mappend #-}-        mappend = (++)         {-# INLINE mconcat #-}         mconcat xss = [x | xs <- xss, x <- xs] -- See Note: [List comprehensions and inlining]@@ -266,66 +323,104 @@ efficient translations anyway. -} +-- | @since 4.9.0.0+instance Semigroup (NonEmpty a) where+        (a :| as) <> ~(b :| bs) = a :| (as ++ b : bs)++-- | @since 4.9.0.0+instance Semigroup b => Semigroup (a -> b) where+        f <> g = \x -> f x <> g x+        stimes n f e = stimes n (f e)+ -- | @since 2.01 instance Monoid b => Monoid (a -> b) where         mempty _ = mempty-        mappend f g x = f x `mappend` g x +-- | @since 4.9.0.0+instance Semigroup () where+        _ <> _      = ()+        sconcat _   = ()+        stimes  _ _ = ()+ -- | @since 2.01 instance Monoid () where         -- Should it be strict?         mempty        = ()-        _ `mappend` _ = ()         mconcat _     = () +-- | @since 4.9.0.0+instance (Semigroup a, Semigroup b) => Semigroup (a, b) where+        (a,b) <> (a',b') = (a<>a',b<>b')+        stimes n (a,b) = (stimes n a, stimes n b)+ -- | @since 2.01 instance (Monoid a, Monoid b) => Monoid (a,b) where         mempty = (mempty, mempty)-        (a1,b1) `mappend` (a2,b2) =-                (a1 `mappend` a2, b1 `mappend` b2) +-- | @since 4.9.0.0+instance (Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c) where+        (a,b,c) <> (a',b',c') = (a<>a',b<>b',c<>c')+        stimes n (a,b,c) = (stimes n a, stimes n b, stimes n c)+ -- | @since 2.01 instance (Monoid a, Monoid b, Monoid c) => Monoid (a,b,c) where         mempty = (mempty, mempty, mempty)-        (a1,b1,c1) `mappend` (a2,b2,c2) =-                (a1 `mappend` a2, b1 `mappend` b2, c1 `mappend` c2) +-- | @since 4.9.0.0+instance (Semigroup a, Semigroup b, Semigroup c, Semigroup d)+         => Semigroup (a, b, c, d) where+        (a,b,c,d) <> (a',b',c',d') = (a<>a',b<>b',c<>c',d<>d')+        stimes n (a,b,c,d) = (stimes n a, stimes n b, stimes n c, stimes n d)+ -- | @since 2.01 instance (Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a,b,c,d) where         mempty = (mempty, mempty, mempty, mempty)-        (a1,b1,c1,d1) `mappend` (a2,b2,c2,d2) =-                (a1 `mappend` a2, b1 `mappend` b2,-                 c1 `mappend` c2, d1 `mappend` d2) +-- | @since 4.9.0.0+instance (Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e)+         => Semigroup (a, b, c, d, e) where+        (a,b,c,d,e) <> (a',b',c',d',e') = (a<>a',b<>b',c<>c',d<>d',e<>e')+        stimes n (a,b,c,d,e) =+            (stimes n a, stimes n b, stimes n c, stimes n d, stimes n e)+ -- | @since 2.01 instance (Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) =>                 Monoid (a,b,c,d,e) where         mempty = (mempty, mempty, mempty, mempty, mempty)-        (a1,b1,c1,d1,e1) `mappend` (a2,b2,c2,d2,e2) =-                (a1 `mappend` a2, b1 `mappend` b2, c1 `mappend` c2,-                 d1 `mappend` d2, e1 `mappend` e2) ++-- | @since 4.9.0.0+instance Semigroup Ordering where+    LT <> _ = LT+    EQ <> y = y+    GT <> _ = GT++    stimes = stimesIdempotentMonoid+ -- lexicographical ordering -- | @since 2.01 instance Monoid Ordering where-        mempty         = EQ-        LT `mappend` _ = LT-        EQ `mappend` y = y-        GT `mappend` _ = GT+    mempty             = EQ +-- | @since 4.9.0.0+instance Semigroup a => Semigroup (Maybe a) where+    Nothing <> b       = b+    a       <> Nothing = a+    Just a  <> Just b  = Just (a <> b)++    stimes = stimesMaybe+ -- | Lift a semigroup into 'Maybe' forming a 'Monoid' according to -- <http://en.wikipedia.org/wiki/Monoid>: \"Any semigroup @S@ may be -- turned into a monoid simply by adjoining an element @e@ not in @S@--- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S@.\" Since--- there used to be no \"Semigroup\" typeclass providing just 'mappend',--- we use 'Monoid' instead.+-- and defining @e*e = e@ and @e*s = s = s*e@ for all @s ∈ S@.\" --+-- /Since 4.11.0/: constraint on inner @a@ value generalised from+-- 'Monoid' to 'Semigroup'.+-- -- @since 2.01-instance Monoid a => Monoid (Maybe a) where-  mempty = Nothing-  Nothing `mappend` m = m-  m `mappend` Nothing = m-  Just m1 `mappend` Just m2 = Just (m1 `mappend` m2)+instance Semigroup a => Monoid (Maybe a) where+    mempty = Nothing  -- | For tuples, the 'Monoid' constraint on @a@ determines -- how the first values merge.@@ -337,17 +432,20 @@ -- @since 2.01 instance Monoid a => Applicative ((,) a) where     pure x = (mempty, x)-    (u, f) <*> (v, x) = (u `mappend` v, f x)-    liftA2 f (u, x) (v, y) = (u `mappend` v, f x y)+    (u, f) <*> (v, x) = (u <> v, f x)+    liftA2 f (u, x) (v, y) = (u <> v, f x y)  -- | @since 4.9.0.0 instance Monoid a => Monad ((,) a) where-    (u, a) >>= k = case k a of (v, b) -> (u `mappend` v, b)+    (u, a) >>= k = case k a of (v, b) -> (u <> v, b) +-- | @since 4.10.0.0+instance Semigroup a => Semigroup (IO a) where+    (<>) = liftA2 (<>)+ -- | @since 4.9.0.0 instance Monoid a => Monoid (IO a) where     mempty = pure mempty-    mappend = liftA2 mappend  {- | The 'Functor' class is used for types that can be mapped over. Instances of 'Functor' should satisfy the following laws:@@ -379,6 +477,7 @@ -- the same as their default definitions: -- --      @('<*>') = 'liftA2' 'id'@+-- --      @'liftA2' f x y = f '<$>' x '<*>' y@ -- -- Further, any definition must satisfy the following:@@ -427,6 +526,8 @@ -- --   * @('<*>') = 'ap'@ --+--   * @('*>') = ('>>')@+-- -- (which implies that 'pure' and '<*>' satisfy the applicative functor laws).  class Functor f => Applicative f where@@ -629,8 +730,8 @@ -- | Promote a function to a monad, scanning the monadic arguments from -- left to right.  For example, ----- >    liftM2 (+) [0,1] [0,2] = [0,2,1,3]--- >    liftM2 (+) (Just 1) Nothing = Nothing+-- > liftM2 (+) [0,1] [0,2] = [0,2,1,3]+-- > liftM2 (+) (Just 1) Nothing = Nothing -- liftM2  :: (Monad m) => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r liftM2 f m1 m2          = do { x1 <- m1; x2 <- m2; return (f x1 x2) }@@ -671,11 +772,11 @@ {- | In many situations, the 'liftM' operations can be replaced by uses of 'ap', which promotes function application. ->       return f `ap` x1 `ap` ... `ap` xn+> return f `ap` x1 `ap` ... `ap` xn  is equivalent to ->       liftMn f x1 x2 ... xn+> liftMn f x1 x2 ... xn  -} @@ -744,9 +845,9 @@ -- If defined, 'some' and 'many' should be the least solutions -- of the equations: ----- * @some v = (:) '<$>' v '<*>' many v@+-- * @'some' v = (:) '<$>' v '<*>' 'many' v@ ----- * @many v = some v '<|>' 'pure' []@+-- * @'many' v = 'some' v '<|>' 'pure' []@ class Applicative f => Alternative f where     -- | The identity of '<|>'     empty :: f a@@ -779,21 +880,59 @@  -- | Monads that also support choice and failure. class (Alternative m, Monad m) => MonadPlus m where-   -- | the identity of 'mplus'.  It should also satisfy the equations+   -- | The identity of 'mplus'.  It should also satisfy the equations    --    -- > mzero >>= f  =  mzero    -- > v >> mzero   =  mzero    --+   -- The default definition is+   --+   -- @+   -- mzero = 'empty'+   -- @    mzero :: m a    mzero = empty -   -- | an associative operation+   -- | An associative operation. The default definition is+   --+   -- @+   -- mplus = ('<|>')+   -- @    mplus :: m a -> m a -> m a    mplus = (<|>)  -- | @since 2.01 instance MonadPlus Maybe +---------------------------------------------+-- The non-empty list type++infixr 5 :|++-- | Non-empty (and non-strict) list type.+--+-- @since 4.9.0.0+data NonEmpty a = a :| [a]+  deriving (Eq, Ord)++-- | @since 4.9.0.0+instance Functor NonEmpty where+  fmap f ~(a :| as) = f a :| fmap f as+  b <$ ~(_ :| as)   = b   :| (b <$ as)++-- | @since 4.9.0.0+instance Applicative NonEmpty where+  pure a = a :| []+  (<*>) = ap+  liftA2 = liftM2++-- | @since 4.9.0.0+instance Monad NonEmpty where+  ~(a :| as) >>= f = b :| (bs ++ bs')+    where b :| bs = f a+          bs' = as >>= toList . f+          toList ~(c :| cs) = c : cs+ ---------------------------------------------- -- The list type @@ -951,26 +1090,41 @@ {-# INLINE [0] mapFB #-} -- See Note [Inline FB functions] in GHC.List mapFB c f = \x ys -> c (f x) ys --- The rules for map work like this.------ Up to (but not including) phase 1, we use the "map" rule to--- rewrite all saturated applications of map with its build/fold--- form, hoping for fusion to happen.--- In phase 1 and 0, we switch off that rule, inline build, and--- switch on the "mapList" rule, which rewrites the foldr/mapFB--- thing back into plain map.------ It's important that these two rules aren't both active at once--- (along with build's unfolding) else we'd get an infinite loop--- in the rules.  Hence the activation control below.------ This same pattern is followed by many other functions:--- e.g. append, filter, iterate, repeat, etc.------ The "mapFB" rule optimises compositions of map and--- the "mapFB/id" rule get rids of 'map id' calls.--- (Any similarity to the Functor laws for [] is expected.)+{- Note [The rules for map]+~~~~~~~~~~~~~~~~~~~~~~~~~~~+The rules for map work like this. +* Up to (but not including) phase 1, we use the "map" rule to+  rewrite all saturated applications of map with its build/fold+  form, hoping for fusion to happen.++  In phase 1 and 0, we switch off that rule, inline build, and+  switch on the "mapList" rule, which rewrites the foldr/mapFB+  thing back into plain map.++  It's important that these two rules aren't both active at once+  (along with build's unfolding) else we'd get an infinite loop+  in the rules.  Hence the activation control below.++* This same pattern is followed by many other functions:+  e.g. append, filter, iterate, repeat, etc. in GHC.List++  See also Note [Inline FB functions] in GHC.List++* The "mapFB" rule optimises compositions of map++* The "mapFB/id" rule gets rid of 'map id' calls.+  You might think that (mapFB c id) will turn into c simply+  when mapFB is inlined; but before that happens the "mapList"+  rule turns+     (foldr (mapFB (:) id) [] a+  back into+     map id+  Which is not very clever.++* Any similarity to the Functor laws for [] is expected.+-}+ {-# RULES "map"       [~1] forall f xs.   map f xs                = build (\c n -> foldr (mapFB c f) n xs) "mapList"   [1]  forall f.      foldr (mapFB (:) f) []  = map f@@ -1067,6 +1221,8 @@ ----------------------------------------------  -- | Identity function.+--+-- > id x = x id                      :: a -> a id x                    =  x @@ -1100,7 +1256,8 @@ data Opaque = forall a. O a -- | @const x@ is a unary function which evaluates to @x@ for all inputs. ----- For instance,+-- >>> const 42 "hello"+-- 42 -- -- >>> map (const 42) [0..3] -- [42,42,42,42]@@ -1115,6 +1272,9 @@ (.) f g = \x -> f (g x)  -- | @'flip' f@ takes its (first) two arguments in the reverse order of @f@.+--+-- >>> flip (++) "hello" "world"+-- "worldhello" flip                    :: (a -> b -> c) -> b -> a -> c flip f x y              =  f y x @@ -1123,7 +1283,7 @@ -- low, right-associative binding precedence, so it sometimes allows -- parentheses to be omitted; for example: ----- >     f $ g $ h x  =  f (g (h x))+-- > f $ g $ h x  =  f (g (h x)) -- -- It is also useful in higher-order situations, such as @'map' ('$' 0) xs@, -- or @'Data.List.zipWith' ('$') fs xs@.
+ GHC/Base.hs-boot view
@@ -0,0 +1,10 @@+{-# LANGUAGE NoImplicitPrelude #-}++module GHC.Base where++import GHC.Types ()++class Semigroup a+class Monoid a++data Maybe a = Nothing | Just a
+ GHC/ByteOrder.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE CPP #-}++-----------------------------------------------------------------------------+-- |+-- Module      :  GHC.ByteOrder+-- Copyright   :  (c) The University of Glasgow, 1994-2000+-- License     :  see libraries/base/LICENSE+--+-- Maintainer  :  cvs-ghc@haskell.org+-- Stability   :  internal+-- Portability :  non-portable (GHC extensions)+--+-- Target byte ordering.+--+-----------------------------------------------------------------------------++module GHC.ByteOrder where++-- | Byte ordering.+data ByteOrder+    = BigEndian    -- ^ most-significant-byte occurs in lowest address.+    | LittleEndian -- ^ least-significant-byte occurs in lowest address.+    deriving (Eq, Ord, Bounded, Enum, Read, Show)++-- | The byte ordering of the target machine.+targetByteOrder :: ByteOrder+#if defined(WORDS_BIGENDIAN)+targetByteOrder = BigEndian+#else+targetByteOrder = LittleEndian+#endif
+ GHC/Clock.hsc view
@@ -0,0 +1,25 @@+{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE NoImplicitPrelude #-}++module GHC.Clock+    ( getMonotonicTime+    , getMonotonicTimeNSec+    ) where++import GHC.Base+import GHC.Real+import Data.Word++-- | Return monotonic time in seconds, since some unspecified starting point+--+-- @since 4.11.0.0+getMonotonicTime :: IO Double+getMonotonicTime = do w <- getMonotonicTimeNSec+                      return (fromIntegral w / 1000000000)++-- | Return monotonic time in nanoseconds, since some unspecified starting point+--+-- @since 4.11.0.0+foreign import ccall unsafe "getMonotonicNSec"+    getMonotonicTimeNSec :: IO Word64+
GHC/Conc.hs view
@@ -86,7 +86,7 @@          -- * Miscellaneous         , withMVar-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)         , asyncRead         , asyncWrite         , asyncDoProc@@ -95,14 +95,14 @@         , asyncWriteBA #endif -#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)         , Signal, HandlerFun, setHandler, runHandlers #endif          , ensureIOManagerIsRunning         , ioManagerCapabilitiesChanged -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)         , ConsoleEvent(..)         , win32ConsoleHandler         , toWin32ConsoleEvent@@ -116,6 +116,6 @@ import GHC.Conc.IO import GHC.Conc.Sync -#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS) import GHC.Conc.Signal #endif
GHC/Conc/IO.hs view
@@ -39,7 +39,7 @@         , threadWaitWriteSTM         , closeFdWith -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)         , asyncRead         , asyncWrite         , asyncDoProc@@ -59,7 +59,7 @@ import GHC.Real ( fromIntegral ) import System.Posix.Types -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) import qualified GHC.Conc.Windows as Windows import GHC.Conc.Windows (asyncRead, asyncWrite, asyncDoProc, asyncReadBA,                          asyncWriteBA, ConsoleEvent(..), win32ConsoleHandler,@@ -69,14 +69,14 @@ #endif  ensureIOManagerIsRunning :: IO ()-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS) ensureIOManagerIsRunning = Event.ensureIOManagerIsRunning #else ensureIOManagerIsRunning = Windows.ensureIOManagerIsRunning #endif  ioManagerCapabilitiesChanged :: IO ()-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS) ioManagerCapabilitiesChanged = Event.ioManagerCapabilitiesChanged #else ioManagerCapabilitiesChanged = return ()@@ -90,7 +90,7 @@ -- that has been used with 'threadWaitRead', use 'closeFdWith'. threadWaitRead :: Fd -> IO () threadWaitRead fd-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)   | threaded  = Event.threadWaitRead fd #endif   | otherwise = IO $ \s ->@@ -106,7 +106,7 @@ -- that has been used with 'threadWaitWrite', use 'closeFdWith'. threadWaitWrite :: Fd -> IO () threadWaitWrite fd-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)   | threaded  = Event.threadWaitWrite fd #endif   | otherwise = IO $ \s ->@@ -120,7 +120,7 @@ -- in the file descriptor. threadWaitReadSTM :: Fd -> IO (Sync.STM (), IO ()) threadWaitReadSTM fd-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)   | threaded  = Event.threadWaitReadSTM fd #endif   | otherwise = do@@ -139,7 +139,7 @@ -- in the file descriptor. threadWaitWriteSTM :: Fd -> IO (Sync.STM (), IO ()) threadWaitWriteSTM fd-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)   | threaded  = Event.threadWaitWriteSTM fd #endif   | otherwise = do@@ -164,7 +164,7 @@             -> Fd            -- ^ File descriptor to close.             -> IO () closeFdWith close fd-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)   | threaded  = Event.closeFdWith close fd #endif   | otherwise = close fd@@ -178,7 +178,7 @@ -- threadDelay :: Int -> IO () threadDelay time-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   | threaded  = Windows.threadDelay time #else   | threaded  = Event.threadDelay time@@ -193,7 +193,7 @@ -- registerDelay :: Int -> IO (TVar Bool) registerDelay usecs-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   | threaded = Windows.registerDelay usecs #else   | threaded = Event.registerDelay usecs
GHC/Conc/Sync.hs view
@@ -487,7 +487,7 @@    case (myThreadId# s) of (# s1, tid #) -> (# s1, ThreadId tid #)  --- |The 'yield' action allows (forces, in a co-operative multitasking+-- | The 'yield' action allows (forces, in a co-operative multitasking -- implementation) a context-switch to any other currently runnable -- threads (if any), and is occasionally useful when implementing -- concurrency abstractions.@@ -591,7 +591,7 @@      mk_stat 17 = ThreadDied      mk_stat _  = ThreadBlocked BlockedOnOther --- | returns the number of the capability on which the thread is currently+-- | Returns the number of the capability on which the thread is currently -- running, and a boolean indicating whether the thread is locked to -- that capability or not.  A thread is locked to a capability if it -- was created with @forkOn@.@@ -602,7 +602,7 @@    case threadStatus# t s of      (# s', _, cap#, locked# #) -> (# s', (I# cap#, isTrue# (locked# /=# 0#)) #) --- | make a weak pointer to a 'ThreadId'.  It can be important to do+-- | Make a weak pointer to a 'ThreadId'.  It can be important to do -- this if you want to hold a reference to a 'ThreadId' while still -- allowing the thread to receive the @BlockedIndefinitely@ family of -- exceptions (e.g. 'BlockedIndefinitelyOnMVar').  Holding a normal@@ -714,32 +714,42 @@ unsafeIOToSTM :: IO a -> STM a unsafeIOToSTM (IO m) = STM m --- |Perform a series of STM actions atomically.+-- | Perform a series of STM actions atomically. ----- You cannot use 'atomically' inside an 'unsafePerformIO' or 'unsafeInterleaveIO'.--- Any attempt to do so will result in a runtime error.  (Reason: allowing--- this would effectively allow a transaction inside a transaction, depending--- on exactly when the thunk is evaluated.)+-- Using 'atomically' inside an 'unsafePerformIO' or 'unsafeInterleaveIO'+-- subverts some of guarantees that STM provides. It makes it possible to+-- run a transaction inside of another transaction, depending on when the+-- thunk is evaluated. If a nested transaction is attempted, an exception+-- is thrown by the runtime. It is possible to safely use 'atomically' inside+-- 'unsafePerformIO' or 'unsafeInterleaveIO', but the typechecker does not+-- rule out programs that may attempt nested transactions, meaning that+-- the programmer must take special care to prevent these. ----- However, see 'newTVarIO', which can be called inside 'unsafePerformIO',--- and which allows top-level TVars to be allocated.+-- However, there are functions for creating transactional variables that+-- can always be safely called in 'unsafePerformIO'. See: 'newTVarIO',+-- 'newTChanIO', 'newBroadcastTChanIO', 'newTQueueIO', 'newTBQueueIO',+-- and 'newTMVarIO'.+--+-- Using 'unsafePerformIO' inside of 'atomically' is also dangerous but for+-- different reasons. See 'unsafeIOToSTM' for more on this.  atomically :: STM a -> IO a atomically (STM m) = IO (\s -> (atomically# m) s ) --- |Retry execution of the current memory transaction because it has seen--- values in TVars which mean that it should not continue (e.g. the TVars+-- | Retry execution of the current memory transaction because it has seen+-- values in 'TVar's which mean that it should not continue (e.g. the 'TVar's -- represent a shared buffer that is now empty).  The implementation may--- block the thread until one of the TVars that it has read from has been--- udpated. (GHC only)+-- block the thread until one of the 'TVar's that it has read from has been+-- updated. (GHC only) retry :: STM a retry = STM $ \s# -> retry# s# --- |Compose two alternative STM actions (GHC only).  If the first action--- completes without retrying then it forms the result of the orElse.--- Otherwise, if the first action retries, then the second action is--- tried in its place.  If both actions retry then the orElse as a--- whole retries.+-- | Compose two alternative STM actions (GHC only).+--+-- If the first action completes without retrying then it forms the result of+-- the 'orElse'. Otherwise, if the first action retries, then the second action+-- is tried in its place. If both actions retry then the 'orElse' as a whole+-- retries. orElse :: STM a -> STM a -> STM a orElse (STM m) e = STM $ \s -> catchRetry# m (unSTM e) s @@ -772,16 +782,17 @@                      Just e' -> unSTM (handler e')                      Nothing -> raiseIO# e --- | Low-level primitive on which always and alwaysSucceeds are built.--- checkInv differs form these in that (i) the invariant is not--- checked when checkInv is called, only at the end of this and--- subsequent transcations, (ii) the invariant failure is indicated--- by raising an exception.+-- | Low-level primitive on which 'always' and 'alwaysSucceeds' are built.+-- 'checkInv' differs from these in that,+--+-- 1. the invariant is not checked when 'checkInv' is called, only at the end of+-- this and subsequent transactions+-- 2. the invariant failure is indicated by raising an exception. checkInv :: STM a -> STM () checkInv (STM m) = STM (\s -> case (check# m) s of s' -> (# s', () #)) --- | alwaysSucceeds adds a new invariant that must be true when passed--- to alwaysSucceeds, at the end of the current transaction, and at+-- | 'alwaysSucceeds' adds a new invariant that must be true when passed+-- to 'alwaysSucceeds', at the end of the current transaction, and at -- the end of every subsequent transaction.  If it fails at any -- of those points then the transaction violating it is aborted -- and the exception raised by the invariant is propagated.@@ -789,9 +800,9 @@ alwaysSucceeds i = do ( i >> retry ) `orElse` ( return () )                       checkInv i --- | always is a variant of alwaysSucceeds in which the invariant is--- expressed as an STM Bool action that must return True.  Returning--- False or raising an exception are both treated as invariant failures.+-- | 'always' is a variant of 'alwaysSucceeds' in which the invariant is+-- expressed as an @STM Bool@ action that must return @True@.  Returning+-- @False@ or raising an exception are both treated as invariant failures. always :: STM Bool -> STM () always i = alwaysSucceeds ( do v <- i                                if (v) then return () else ( errorWithoutStackTrace "Transactional invariant violation" ) )@@ -803,13 +814,13 @@ instance Eq (TVar a) where         (TVar tvar1#) == (TVar tvar2#) = isTrue# (sameTVar# tvar1# tvar2#) --- |Create a new TVar holding a value supplied+-- | Create a new 'TVar' holding a value supplied newTVar :: a -> STM (TVar a) newTVar val = STM $ \s1# ->     case newTVar# val s1# of          (# s2#, tvar# #) -> (# s2#, TVar tvar# #) --- |@IO@ version of 'newTVar'.  This is useful for creating top-level+-- | @IO@ version of 'newTVar'.  This is useful for creating top-level -- 'TVar's using 'System.IO.Unsafe.unsafePerformIO', because using -- 'atomically' inside 'System.IO.Unsafe.unsafePerformIO' isn't -- possible.@@ -818,7 +829,7 @@     case newTVar# val s1# of          (# s2#, tvar# #) -> (# s2#, TVar tvar# #) --- |Return the current value stored in a TVar.+-- | Return the current value stored in a 'TVar'. -- This is equivalent to -- -- >  readTVarIO = atomically . readTVar@@ -828,11 +839,11 @@ readTVarIO :: TVar a -> IO a readTVarIO (TVar tvar#) = IO $ \s# -> readTVarIO# tvar# s# --- |Return the current value stored in a TVar+-- |Return the current value stored in a 'TVar'. readTVar :: TVar a -> STM a readTVar (TVar tvar#) = STM $ \s# -> readTVar# tvar# s# --- |Write the supplied value into a TVar+-- |Write the supplied value into a 'TVar'. writeTVar :: TVar a -> a -> STM () writeTVar (TVar tvar#) val = STM $ \s1# ->     case writeTVar# tvar# val s1# of@@ -842,6 +853,8 @@ -- MVar utilities ----------------------------------------------------------------------------- +-- | Provide an 'IO' action with the current value of an 'MVar'. The 'MVar'+-- will be empty for the duration that the action is running. withMVar :: MVar a -> (a -> IO b) -> IO b withMVar m io =   mask $ \restore -> do@@ -851,6 +864,7 @@     putMVar m a     return b +-- | Modify the value of an 'MVar'. modifyMVar_ :: MVar a -> (a -> IO a) -> IO () modifyMVar_ m io =   mask $ \restore -> do
GHC/Conc/Windows.hs view
@@ -53,7 +53,7 @@ import GHC.Word (Word32, Word64) import GHC.Windows -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) # if defined(i386_HOST_ARCH) #  define WINDOWS_CCONV stdcall # elif defined(x86_64_HOST_ARCH)
GHC/Environment.hs view
@@ -8,11 +8,10 @@ import Foreign.C import GHC.Base import GHC.Real ( fromIntegral )--#ifdef mingw32_HOST_OS-import GHC.IO (finally)-import GHC.Windows+import GHC.IO.Encoding+import qualified GHC.Foreign as GHC +#if defined(mingw32_HOST_OS) # if defined(i386_HOST_ARCH) #  define WINDOWS_CCONV stdcall # elif defined(x86_64_HOST_ARCH)@@ -20,9 +19,6 @@ # else #  error Unknown mingw32 arch # endif-#else-import GHC.IO.Encoding-import qualified GHC.Foreign as GHC #endif  -- | Computation 'getFullArgs' is the "raw" version of 'getArgs', similar@@ -30,37 +26,14 @@ -- command line arguments, starting with the program name, and -- including those normally eaten by the RTS (+RTS ... -RTS). getFullArgs :: IO [String]-#ifdef mingw32_HOST_OS--- Ignore the arguments to hs_init on Windows for the sake of Unicode compat getFullArgs = do-    p_arg_string <- c_GetCommandLine-    alloca $ \p_argc -> do-     p_argv <- c_CommandLineToArgv p_arg_string p_argc-     if p_argv == nullPtr-      then throwGetLastError "getFullArgs"-      else flip finally (c_LocalFree p_argv) $ do-       argc <- peek p_argc-       p_argvs <- peekArray (fromIntegral argc) p_argv-       mapM peekCWString p_argvs--foreign import WINDOWS_CCONV unsafe "windows.h GetCommandLineW"-    c_GetCommandLine :: IO (Ptr CWString)--foreign import WINDOWS_CCONV unsafe "windows.h CommandLineToArgvW"-    c_CommandLineToArgv :: Ptr CWString -> Ptr CInt -> IO (Ptr CWString)--foreign import WINDOWS_CCONV unsafe "Windows.h LocalFree"-    c_LocalFree :: Ptr a -> IO (Ptr a)-#else-getFullArgs =-  alloca $ \ p_argc ->-  alloca $ \ p_argv -> do-   getFullProgArgv p_argc p_argv-   p    <- fromIntegral `liftM` peek p_argc-   argv <- peek p_argv-   enc <- getFileSystemEncoding-   peekArray p argv >>= mapM (GHC.peekCString enc)+  alloca $ \ p_argc -> do+    alloca $ \ p_argv -> do+        getFullProgArgv p_argc p_argv+        p    <- fromIntegral `liftM` peek p_argc+        argv <- peek p_argv+        enc <- argvEncoding+        peekArray p argv >>= mapM (GHC.peekCString enc)  foreign import ccall unsafe "getFullProgArgv"     getFullProgArgv :: Ptr CInt -> Ptr (Ptr CString) -> IO ()-#endif
− GHC/Event/Clock.hsc
@@ -1,17 +0,0 @@-{-# LANGUAGE Trustworthy #-}-{-# LANGUAGE NoImplicitPrelude #-}--module GHC.Event.Clock (getMonotonicTime) where--import GHC.Base-import GHC.Real-import Data.Word---- | Return monotonic time in seconds, since some unspecified starting point-getMonotonicTime :: IO Double-getMonotonicTime = do w <- getMonotonicNSec-                      return (fromIntegral w / 1000000000)--foreign import ccall unsafe "getMonotonicNSec"-    getMonotonicNSec :: IO Word64-
GHC/Event/EPoll.hsc view
@@ -48,7 +48,7 @@ import Foreign.Storable (Storable(..)) import GHC.Base import GHC.Num (Num(..))-import GHC.Real (ceiling, fromIntegral)+import GHC.Real (fromIntegral, div) import GHC.Show (Show) import System.Posix.Internals (c_close) import System.Posix.Internals (setCloseOnExec)@@ -223,7 +223,9 @@  fromTimeout :: Timeout -> Int fromTimeout Forever     = -1-fromTimeout (Timeout s) = ceiling $ 1000 * s+fromTimeout (Timeout s) = fromIntegral $ s `divRoundUp` 1000000+  where+    divRoundUp num denom = (num + denom - 1) `div` denom  foreign import ccall unsafe "sys/epoll.h epoll_create"     c_epoll_create :: CInt -> IO CInt
GHC/Event/Internal.hs view
@@ -33,8 +33,10 @@ import Foreign.C.Error (eINTR, getErrno, throwErrno) import System.Posix.Types (Fd) import GHC.Base+import GHC.Word (Word64) import GHC.Num (Num(..)) import GHC.Show (Show(..))+import Data.Semigroup.Internal (stimesMonoid)  -- | An I\/O event. newtype Event = Event Int@@ -71,10 +73,14 @@         where ev `so` disp | e `eventIs` ev = disp                            | otherwise      = "" +-- | @since 4.10.0.0+instance Semigroup Event where+    (<>)    = evtCombine+    stimes  = stimesMonoid+ -- | @since 4.3.1.0 instance Monoid Event where     mempty  = evtNothing-    mappend = evtCombine     mconcat = evtConcat  evtCombine :: Event -> Event -> Event@@ -99,12 +105,16 @@ elSupremum _       _       = MultiShot {-# INLINE elSupremum #-} +-- | @since 4.10.0.0+instance Semigroup Lifetime where+    (<>) = elSupremum+    stimes = stimesMonoid+ -- | @mappend@ takes the longer of two lifetimes. -- -- @since 4.8.0.0 instance Monoid Lifetime where     mempty = OneShot-    mappend = elSupremum  -- | A pair of an event and lifetime --@@ -113,10 +123,13 @@ newtype EventLifetime = EL Int                       deriving (Show, Eq) +-- | @since 4.11.0.0+instance Semigroup EventLifetime where+    EL a <> EL b = EL (a .|. b)+ -- | @since 4.8.0.0 instance Monoid EventLifetime where     mempty = EL 0-    EL a `mappend` EL b = EL (a .|. b)  eventLifetime :: Event -> Lifetime -> EventLifetime eventLifetime (Event e) l = EL (e .|. lifetimeBit l)@@ -133,8 +146,8 @@ elEvent (EL x) = Event (x .&. 0x7) {-# INLINE elEvent #-} --- | A type alias for timeouts, specified in seconds.-data Timeout = Timeout {-# UNPACK #-} !Double+-- | A type alias for timeouts, specified in nanoseconds.+data Timeout = Timeout {-# UNPACK #-} !Word64              | Forever                deriving (Show) 
GHC/Event/KQueue.hsc view
@@ -28,17 +28,19 @@  import Data.Bits (Bits(..), FiniteBits(..)) import Data.Int+import Data.Maybe ( catMaybes ) import Data.Word (Word16, Word32) import Foreign.C.Error (throwErrnoIfMinus1, eINTR, eINVAL,                         eNOTSUP, getErrno, throwErrno) import Foreign.C.Types import Foreign.Marshal.Alloc (alloca)+import Foreign.Marshal.Array (withArrayLen) import Foreign.Ptr (Ptr, nullPtr) import Foreign.Storable (Storable(..)) import GHC.Base import GHC.Enum (toEnum) import GHC.Num (Num(..))-import GHC.Real (ceiling, floor, fromIntegral)+import GHC.Real (quotRem, fromIntegral) import GHC.Show (Show(show)) import GHC.Event.Internal (Timeout(..)) import System.Posix.Internals (c_close)@@ -56,7 +58,7 @@ -- Handle brokenness on some BSD variants, notably OS X up to at least -- 10.6.  If NOTE_EOF isn't available, we have no way to receive a -- notification from the kernel when we reach EOF on a plain file.-#ifndef NOTE_EOF+#if !defined(NOTE_EOF) # define NOTE_EOF 0 #endif @@ -85,23 +87,20 @@   return ()  modifyFd :: KQueue -> Fd -> E.Event -> E.Event -> IO Bool-modifyFd kq fd oevt nevt-  | nevt == mempty = do-      let !ev = event fd (toFilter oevt) flagDelete noteEOF-      kqueueControl (kqueueFd kq) ev-  | otherwise      = do-      let !ev = event fd (toFilter nevt) flagAdd noteEOF-      kqueueControl (kqueueFd kq) ev+modifyFd kq fd oevt nevt = kqueueControl (kqueueFd kq) evs+  where+    evs+      | nevt == mempty = toEvents fd (toFilter oevt) flagDelete noteEOF+      | otherwise      = toEvents fd (toFilter nevt) flagAdd noteEOF -toFilter :: E.Event -> Filter-toFilter evt-  | evt `E.eventIs` E.evtRead = filterRead-  | otherwise                 = filterWrite+toFilter :: E.Event -> [Filter]+toFilter e = catMaybes [ check E.evtRead filterRead, check E.evtWrite filterWrite ]+  where+    check e' f = if e `E.eventIs` e' then Just f else Nothing  modifyFdOnce :: KQueue -> Fd -> E.Event -> IO Bool-modifyFdOnce kq fd evt = do-    let !ev = event fd (toFilter evt) (flagAdd .|. flagOneshot) noteEOF-    kqueueControl (kqueueFd kq) ev+modifyFdOnce kq fd evt =+    kqueueControl (kqueueFd kq) (toEvents fd (toFilter evt) (flagAdd .|. flagOneshot) noteEOF)  poll :: KQueue      -> Maybe Timeout@@ -132,7 +131,7 @@     , filter :: {-# UNPACK #-} !Filter     , flags  :: {-# UNPACK #-} !Flag     , fflags :: {-# UNPACK #-} !FFlag-#ifdef netbsd_HOST_OS+#if defined(netbsd_HOST_OS)     , data_  :: {-# UNPACK #-} !Int64 #else     , data_  :: {-# UNPACK #-} !CIntPtr@@ -140,8 +139,8 @@     , udata  :: {-# UNPACK #-} !(Ptr ())     } deriving Show -event :: Fd -> Filter -> Flag -> FFlag -> Event-event fd filt flag fflag = KEvent (fromIntegral fd) filt flag fflag 0 nullPtr+toEvents :: Fd -> [Filter] -> Flag -> FFlag -> [Event]+toEvents fd flts flag fflag = map (\filt -> KEvent (fromIntegral fd) filt flag fflag 0 nullPtr) flts  -- | @since 4.3.1.0 instance Storable Event where@@ -192,7 +191,7 @@ #else newtype Filter = Filter Int16 #endif-    deriving (Bits, FiniteBits, Eq, Num, Show, Storable)+    deriving (Eq, Num, Show, Storable)  filterRead :: Filter filterRead = Filter (#const EVFILT_READ)@@ -222,11 +221,11 @@ kqueue :: IO KQueueFd kqueue = KQueueFd `fmap` throwErrnoIfMinus1 "kqueue" c_kqueue -kqueueControl :: KQueueFd -> Event -> IO Bool-kqueueControl kfd ev =+kqueueControl :: KQueueFd -> [Event] -> IO Bool+kqueueControl kfd evts =     withTimeSpec (TimeSpec 0 0) $ \tp ->-        withEvent ev $ \evp -> do-            res <- kevent False kfd evp 1 nullPtr 0 tp+        withArrayLen evts $ \evlen evp -> do+            res <- kevent False kfd evp evlen nullPtr 0 tp             if res == -1               then do                err <- getErrno@@ -255,9 +254,6 @@   | safe      = c_kevent k chs (fromIntegral chlen) evs (fromIntegral evlen) ts   | otherwise = c_kevent_unsafe k chs (fromIntegral chlen) evs (fromIntegral evlen) ts -withEvent :: Event -> (Ptr Event -> IO a) -> IO a-withEvent ev f = alloca $ \ptr -> poke ptr ev >> f ptr- withTimeSpec :: TimeSpec -> (Ptr TimeSpec -> IO a) -> IO a withTimeSpec ts f   | tv_sec ts < 0 = f nullPtr@@ -265,13 +261,13 @@  fromTimeout :: Timeout -> TimeSpec fromTimeout Forever     = TimeSpec (-1) (-1)-fromTimeout (Timeout s) = TimeSpec (toEnum sec) (toEnum nanosec)+fromTimeout (Timeout s) = TimeSpec (toEnum sec') (toEnum nanosec')   where-    sec :: Int-    sec     = floor s+    (sec, nanosec) = s `quotRem` 1000000000 -    nanosec :: Int-    nanosec = ceiling $ (s - fromIntegral sec) * 1000000000+    nanosec', sec' :: Int+    sec' = fromIntegral sec+    nanosec' = fromIntegral nanosec  toEvent :: Filter -> E.Event toEvent (Filter f)
GHC/Event/PSQ.hs view
@@ -1,58 +1,17 @@-{-# LANGUAGE Trustworthy #-}-{-# LANGUAGE BangPatterns, NoImplicitPrelude #-}---- Copyright (c) 2008, Ralf Hinze--- All rights reserved.------ Redistribution and use in source and binary forms, with or without--- modification, are permitted provided that the following conditions--- are met:------     * Redistributions of source code must retain the above---       copyright notice, this list of conditions and the following---       disclaimer.------     * Redistributions in binary form must reproduce the above---       copyright notice, this list of conditions and the following---       disclaimer in the documentation and/or other materials---       provided with the distribution.------     * The names of the contributors may not be used to endorse or---       promote products derived from this software without specific---       prior written permission.------ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS--- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT--- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS--- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE--- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,--- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES--- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR--- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)--- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,--- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)--- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED--- OF THE POSSIBILITY OF SUCH DAMAGE.+{-# LANGUAGE Trustworthy       #-}+{-# LANGUAGE BangPatterns      #-}+{-# LANGUAGE CPP               #-}+{-# LANGUAGE DeriveFoldable    #-}+{-# LANGUAGE DeriveFunctor     #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE MagicHash         #-}+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE UnboxedTuples     #-} --- | A /priority search queue/ (henceforth /queue/) efficiently--- supports the operations of both a search tree and a priority queue.--- An 'Elem'ent is a product of a key, a priority, and a--- value. Elements can be inserted, deleted, modified and queried in--- logarithmic time, and the element with the least priority can be--- retrieved in constant time.  A queue can be built from a list of--- elements, sorted by keys, in linear time.------ This implementation is due to Ralf Hinze with some modifications by--- Scott Dillard and Johan Tibell.------ * Hinze, R., /A Simple Implementation Technique for Priority Search--- Queues/, ICFP 2001, pp. 110-121------ <http://citeseer.ist.psu.edu/hinze01simple.html> module GHC.Event.PSQ     (     -- * Binding Type-    Elem(..)+      Elem(..)     , Key     , Prio @@ -77,8 +36,6 @@      -- * Conversion     , toList-    , toAscList-    , toDescList     , fromList      -- * Min@@ -88,399 +45,410 @@     , atMost     ) where -import GHC.Base hiding (empty)-import GHC.Float () -- for Show Double instance+import GHC.Base hiding (Nat, empty)+import GHC.Event.Unique+import GHC.Word (Word64) import GHC.Num (Num(..))-import GHC.Show (Show(showsPrec))-import GHC.Event.Unique (Unique)+import GHC.Real (fromIntegral)+import GHC.Types (Int) --- | @E k p@ binds the key @k@ with the priority @p@.-data Elem a = E-    { key   :: {-# UNPACK #-} !Key-    , prio  :: {-# UNPACK #-} !Prio-    , value :: a-    } deriving (Eq, Show)+#include "MachDeps.h" ---------------------------------------------------------------------------- | A mapping from keys @k@ to priorites @p@.+-- TODO (SM): get rid of bang patterns -type Prio = Double-type Key = Unique+{-+-- Use macros to define strictness of functions.+-- STRICT_x_OF_y denotes a y-ary function strict in the x-th parameter.+-- We do not use BangPatterns, because they are not in any standard and we+-- want the compilers to be compiled by as many compilers as possible.+#define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined+-} -data PSQ a = Void-           | Winner {-# UNPACK #-} !(Elem a)-                    !(LTree a)-                    {-# UNPACK #-} !Key  -- max key-           deriving (Eq, Show) --- | /O(1)/ The number of elements in a queue.-size :: PSQ a -> Int-size Void            = 0-size (Winner _ lt _) = 1 + size' lt+------------------------------------------------------------------------------+-- Types+------------------------------------------------------------------------------ --- | /O(1)/ True if the queue is empty.-null :: PSQ a -> Bool-null Void           = True-null (Winner _ _ _) = False+type Prio = Word64 --- | /O(log n)/ The priority and value of a given key, or Nothing if--- the key is not bound.-lookup :: Key -> PSQ a -> Maybe (Prio, a)-lookup k q = case tourView q of-    Null -> Nothing-    Single (E k' p v)-        | k == k'   -> Just (p, v)-        | otherwise -> Nothing-    tl `Play` tr-        | k <= maxKey tl -> lookup k tl-        | otherwise      -> lookup k tr+type Nat = Word ---------------------------------------------------------------------------- Construction+type Key = Unique -empty :: PSQ a-empty = Void+-- | We store masks as the index of the bit that determines the branching.+type Mask = Int --- | /O(1)/ Build a queue with one element.-singleton :: Key -> Prio -> a -> PSQ a-singleton k p v = Winner (E k p v) Start k+type PSQ a = IntPSQ a ---------------------------------------------------------------------------- Insertion+-- | @E k p@ binds the key @k@ with the priority @p@.+data Elem a = E+    { key   :: {-# UNPACK #-} !Key+    , prio  :: {-# UNPACK #-} !Prio+    , value :: a+    } --- | /O(log n)/ Insert a new key, priority and value in the queue.  If--- the key is already present in the queue, the associated priority--- and value are replaced with the supplied priority and value.-insert :: Key -> Prio -> a -> PSQ a -> PSQ a-insert k p v q = case q of-    Void -> singleton k p v-    Winner (E k' p' v') Start _ -> case compare k k' of-        LT -> singleton k  p  v  `play` singleton k' p' v'-        EQ -> singleton k  p  v-        GT -> singleton k' p' v' `play` singleton k  p  v-    Winner e (RLoser _ e' tl m tr) m'-        | k <= m    -> insert k p v (Winner e tl m) `play` (Winner e' tr m')-        | otherwise -> (Winner e tl m) `play` insert k p v (Winner e' tr m')-    Winner e (LLoser _ e' tl m tr) m'-        | k <= m    -> insert k p v (Winner e' tl m) `play` (Winner e tr m')-        | otherwise -> (Winner e' tl m) `play` insert k p v (Winner e tr m')+-- | A priority search queue with @Int@ keys and priorities of type @p@ and+-- values of type @v@. It is strict in keys, priorities and values.+data IntPSQ v+    = Bin {-# UNPACK #-} !Key {-# UNPACK #-} !Prio !v {-# UNPACK #-} !Mask !(IntPSQ v) !(IntPSQ v)+    | Tip {-# UNPACK #-} !Key {-# UNPACK #-} !Prio !v+    | Nil ---------------------------------------------------------------------------- Delete/Update+-- bit twiddling+---------------- --- | /O(log n)/ Delete a key and its priority and value from the--- queue.  When the key is not a member of the queue, the original--- queue is returned.-delete :: Key -> PSQ a -> PSQ a-delete k q = case q of-    Void -> empty-    Winner (E k' p v) Start _-        | k == k'   -> empty-        | otherwise -> singleton k' p v-    Winner e (RLoser _ e' tl m tr) m'-        | k <= m    -> delete k (Winner e tl m) `play` (Winner e' tr m')-        | otherwise -> (Winner e tl m) `play` delete k (Winner e' tr m')-    Winner e (LLoser _ e' tl m tr) m'-        | k <= m    -> delete k (Winner e' tl m) `play` (Winner e tr m')-        | otherwise -> (Winner e' tl m) `play` delete k (Winner e tr m')+(.&.) :: Nat -> Nat -> Nat+(.&.) (W# w1) (W# w2) = W# (w1 `and#` w2)+{-# INLINE (.&.) #-} --- | /O(log n)/ Update a priority at a specific key with the result--- of the provided function.  When the key is not a member of the--- queue, the original queue is returned.-adjust :: (Prio -> Prio) -> Key -> PSQ a -> PSQ a-adjust f k q0 =  go q0+xor :: Nat -> Nat -> Nat+xor (W# w1) (W# w2) = W# (w1 `xor#` w2)+{-# INLINE xor #-}++complement :: Nat -> Nat+complement (W# w) = W# (w `xor#` mb)   where-    go q = case q of-        Void -> empty-        Winner (E k' p v) Start _-            | k == k'   -> singleton k' (f p) v-            | otherwise -> singleton k' p v-        Winner e (RLoser _ e' tl m tr) m'-            | k <= m    -> go (Winner e tl m) `unsafePlay` (Winner e' tr m')-            | otherwise -> (Winner e tl m) `unsafePlay` go (Winner e' tr m')-        Winner e (LLoser _ e' tl m tr) m'-            | k <= m    -> go (Winner e' tl m) `unsafePlay` (Winner e tr m')-            | otherwise -> (Winner e' tl m) `unsafePlay` go (Winner e tr m')-{-# INLINE adjust #-}+#if WORD_SIZE_IN_BITS == 32+    mb = 0xFFFFFFFF##+#elif WORD_SIZE_IN_BITS == 64+    mb = 0xFFFFFFFFFFFFFFFF##+#else+#error Unhandled value for WORD_SIZE_IN_BITS+#endif+{-# INLINE complement #-} ---------------------------------------------------------------------------- Conversion+{-# INLINE natFromInt #-}+natFromInt :: Int -> Nat+natFromInt = fromIntegral --- | /O(n*log n)/ Build a queue from a list of key/priority/value--- tuples.  If the list contains more than one priority and value for--- the same key, the last priority and value for the key is retained.-fromList :: [Elem a] -> PSQ a-fromList = foldr (\(E k p v) q -> insert k p v q) empty+{-# INLINE intFromNat #-}+intFromNat :: Nat -> Int+intFromNat = fromIntegral --- | /O(n)/ Convert to a list of key/priority/value tuples.-toList :: PSQ a -> [Elem a]-toList = toAscList+{-# INLINE zero #-}+zero :: Key -> Mask -> Bool+zero i m+  = (natFromInt (asInt i)) .&. (natFromInt m) == 0 --- | /O(n)/ Convert to an ascending list.-toAscList :: PSQ a -> [Elem a]-toAscList q  = seqToList (toAscLists q)+{-# INLINE nomatch #-}+nomatch :: Key -> Key -> Mask -> Bool+nomatch k1 k2 m =+    natFromInt (asInt k1) .&. m' /= natFromInt (asInt k2) .&. m'+  where+    m' = maskW (natFromInt m) -toAscLists :: PSQ a -> Sequ (Elem a)-toAscLists q = case tourView q of-    Null         -> emptySequ-    Single e     -> singleSequ e-    tl `Play` tr -> toAscLists tl <> toAscLists tr+{-# INLINE maskW #-}+maskW :: Nat -> Nat+maskW m = complement (m-1) `xor` m --- | /O(n)/ Convert to a descending list.-toDescList :: PSQ a -> [ Elem a ]-toDescList q = seqToList (toDescLists q)+{-# INLINE branchMask #-}+branchMask :: Key -> Key -> Mask+branchMask k1' k2' =+    intFromNat (highestBitMask (natFromInt k1 `xor` natFromInt k2))+  where+    k1 = asInt k1'+    k2 = asInt k2' -toDescLists :: PSQ a -> Sequ (Elem a)-toDescLists q = case tourView q of-    Null         -> emptySequ-    Single e     -> singleSequ e-    tl `Play` tr -> toDescLists tr <> toDescLists tl+highestBitMask :: Nat -> Nat+highestBitMask (W# x) =+    W# (uncheckedShiftL# 1## (word2Int# (WORD_SIZE_IN_BITS## `minusWord#` 1## `minusWord#` clz# x)))+{-# INLINE highestBitMask #-} ---------------------------------------------------------------------------- Min+------------------------------------------------------------------------------+-- Query+------------------------------------------------------------------------------ --- | /O(1)/ The element with the lowest priority.-findMin :: PSQ a -> Maybe (Elem a)-findMin Void           = Nothing-findMin (Winner e _ _) = Just e+-- | /O(1)/ True if the queue is empty.+null :: IntPSQ v -> Bool+null Nil = True+null _   = False --- | /O(log n)/ Delete the element with the lowest priority.  Returns--- an empty queue if the queue is empty.-deleteMin :: PSQ a -> PSQ a-deleteMin Void           = Void-deleteMin (Winner _ t m) = secondBest t m+-- | /O(n)/ The number of elements stored in the queue.+size :: IntPSQ v -> Int+size Nil               = 0+size (Tip _ _ _)       = 1+size (Bin _ _ _ _ l r) = 1 + size l + size r+-- TODO (SM): benchmark this against a tail-recursive variant --- | /O(log n)/ Retrieve the binding with the least priority, and the--- rest of the queue stripped of that binding.-minView :: PSQ a -> Maybe (Elem a, PSQ a)-minView Void           = Nothing-minView (Winner e t m) = Just (e, secondBest t m)+-- | /O(min(n,W))/ The priority and value of a given key, or 'Nothing' if the+-- key is not bound.+lookup :: Key -> IntPSQ v -> Maybe (Prio, v)+lookup k = go+  where+    go t = case t of+        Nil                -> Nothing -secondBest :: LTree a -> Key -> PSQ a-secondBest Start _                 = Void-secondBest (LLoser _ e tl m tr) m' = Winner e tl m `play` secondBest tr m'-secondBest (RLoser _ e tl m tr) m' = secondBest tl m `play` Winner e tr m'+        Tip k' p' x'+          | k == k'        -> Just (p', x')+          | otherwise      -> Nothing --- | /O(r*(log n - log r))/ Return a list of elements ordered by--- key whose priorities are at most @pt@.-atMost :: Prio -> PSQ a -> ([Elem a], PSQ a)-atMost pt q = let (sequ, q') = atMosts pt q-              in (seqToList sequ, q')+        Bin k' p' x' m l r+          | nomatch k k' m -> Nothing+          | k == k'        -> Just (p', x')+          | zero k m       -> go l+          | otherwise      -> go r -atMosts :: Prio -> PSQ a -> (Sequ (Elem a), PSQ a)-atMosts !pt q = case q of-    (Winner e _ _)-        | prio e > pt -> (emptySequ, q)-    Void              -> (emptySequ, Void)-    Winner e Start _  -> (singleSequ e, Void)-    Winner e (RLoser _ e' tl m tr) m' ->-        let (sequ, q')   = atMosts pt (Winner e tl m)-            (sequ', q'') = atMosts pt (Winner e' tr m')-        in (sequ <> sequ', q' `play` q'')-    Winner e (LLoser _ e' tl m tr) m' ->-        let (sequ, q')   = atMosts pt (Winner e' tl m)-            (sequ', q'') = atMosts pt (Winner e tr m')-        in (sequ <> sequ', q' `play` q'')+-- | /O(1)/ The element with the lowest priority.+findMin :: IntPSQ v -> Maybe (Elem v)+findMin t = case t of+    Nil             -> Nothing+    Tip k p x       -> Just (E k p x)+    Bin k p x _ _ _ -> Just (E k p x) ---------------------------------------------------------------------------- Loser tree -type Size = Int+------------------------------------------------------------------------------+--- Construction+------------------------------------------------------------------------------ -data LTree a = Start-             | LLoser {-# UNPACK #-} !Size-                      {-# UNPACK #-} !(Elem a)-                      !(LTree a)-                      {-# UNPACK #-} !Key  -- split key-                      !(LTree a)-             | RLoser {-# UNPACK #-} !Size-                      {-# UNPACK #-} !(Elem a)-                      !(LTree a)-                      {-# UNPACK #-} !Key  -- split key-                      !(LTree a)-             deriving (Eq, Show)+-- | /O(1)/ The empty queue.+empty :: IntPSQ v+empty = Nil -size' :: LTree a -> Size-size' Start              = 0-size' (LLoser s _ _ _ _) = s-size' (RLoser s _ _ _ _) = s+-- | /O(1)/ Build a queue with one element.+singleton :: Key -> Prio -> v -> IntPSQ v+singleton = Tip -left, right :: LTree a -> LTree a -left Start                = moduleError "left" "empty loser tree"-left (LLoser _ _ tl _ _ ) = tl-left (RLoser _ _ tl _ _ ) = tl+------------------------------------------------------------------------------+-- Insertion+------------------------------------------------------------------------------ -right Start                = moduleError "right" "empty loser tree"-right (LLoser _ _ _  _ tr) = tr-right (RLoser _ _ _  _ tr) = tr+-- | /O(min(n,W))/ Insert a new key, priority and value into the queue. If the key+-- is already present in the queue, the associated priority and value are+-- replaced with the supplied priority and value.+insert :: Key -> Prio -> v -> IntPSQ v -> IntPSQ v+insert k p x t0 = unsafeInsertNew k p x (delete k t0) -maxKey :: PSQ a -> Key-maxKey Void           = moduleError "maxKey" "empty queue"-maxKey (Winner _ _ m) = m+-- | Internal function to insert a key that is *not* present in the priority+-- queue.+{-# INLINABLE unsafeInsertNew #-}+unsafeInsertNew :: Key -> Prio -> v -> IntPSQ v -> IntPSQ v+unsafeInsertNew k p x = go+  where+    go t = case t of+      Nil       -> Tip k p x -lloser, rloser :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-lloser k p v tl m tr = LLoser (1 + size' tl + size' tr) (E k p v) tl m tr-rloser k p v tl m tr = RLoser (1 + size' tl + size' tr) (E k p v) tl m tr+      Tip k' p' x'+        | (p, k) < (p', k') -> link k  p  x  k' t           Nil+        | otherwise         -> link k' p' x' k  (Tip k p x) Nil ---------------------------------------------------------------------------- Balancing+      Bin k' p' x' m l r+        | nomatch k k' m ->+            if (p, k) < (p', k')+              then link k  p  x  k' t           Nil+              else link k' p' x' k  (Tip k p x) (merge m l r) --- | Balance factor-omega :: Int-omega = 4+        | otherwise ->+            if (p, k) < (p', k')+              then+                if zero k' m+                  then Bin k  p  x  m (unsafeInsertNew k' p' x' l) r+                  else Bin k  p  x  m l (unsafeInsertNew k' p' x' r)+              else+                if zero k m+                  then Bin k' p' x' m (unsafeInsertNew k  p  x  l) r+                  else Bin k' p' x' m l (unsafeInsertNew k  p  x  r) -lbalance, rbalance :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a+-- | Link+link :: Key -> Prio -> v -> Key -> IntPSQ v -> IntPSQ v -> IntPSQ v+link k p x k' k't otherTree+  | zero (Unique m) (asInt k') = Bin k p x m k't otherTree+  | otherwise                  = Bin k p x m otherTree k't+  where+    m = branchMask k k' -lbalance k p v l m r-    | size' l + size' r < 2     = lloser        k p v l m r-    | size' r > omega * size' l = lbalanceLeft  k p v l m r-    | size' l > omega * size' r = lbalanceRight k p v l m r-    | otherwise                 = lloser        k p v l m r -rbalance k p v l m r-    | size' l + size' r < 2     = rloser        k p v l m r-    | size' r > omega * size' l = rbalanceLeft  k p v l m r-    | size' l > omega * size' r = rbalanceRight k p v l m r-    | otherwise                 = rloser        k p v l m r+------------------------------------------------------------------------------+-- Delete/Alter+------------------------------------------------------------------------------ -lbalanceLeft :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-lbalanceLeft  k p v l m r-    | size' (left r) < size' (right r) = lsingleLeft  k p v l m r-    | otherwise                        = ldoubleLeft  k p v l m r+-- | /O(min(n,W))/ Delete a key and its priority and value from the queue. When+-- the key is not a member of the queue, the original queue is returned.+{-# INLINABLE delete #-}+delete :: Key -> IntPSQ v -> IntPSQ v+delete k = go+  where+    go t = case t of+        Nil           -> Nil -lbalanceRight :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-lbalanceRight k p v l m r-    | size' (left l) > size' (right l) = lsingleRight k p v l m r-    | otherwise                        = ldoubleRight k p v l m r+        Tip k' _ _+          | k == k'   -> Nil+          | otherwise -> t -rbalanceLeft :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-rbalanceLeft  k p v l m r-    | size' (left r) < size' (right r) = rsingleLeft  k p v l m r-    | otherwise                        = rdoubleLeft  k p v l m r+        Bin k' p' x' m l r+          | nomatch k k' m -> t+          | k == k'        -> merge m l r+          | zero k m       -> binShrinkL k' p' x' m (go l) r+          | otherwise      -> binShrinkR k' p' x' m l      (go r) -rbalanceRight :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-rbalanceRight k p v l m r-    | size' (left l) > size' (right l) = rsingleRight k p v l m r-    | otherwise                        = rdoubleRight k p v l m r+-- | /O(min(n,W))/ Delete the binding with the least priority, and return the+-- rest of the queue stripped of that binding. In case the queue is empty, the+-- empty queue is returned again.+{-# INLINE deleteMin #-}+deleteMin :: IntPSQ v -> IntPSQ v+deleteMin t = case minView t of+    Nothing      -> t+    Just (_, t') -> t' -lsingleLeft :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-lsingleLeft k1 p1 v1 t1 m1 (LLoser _ (E k2 p2 v2) t2 m2 t3)-    | p1 <= p2  = lloser k1 p1 v1 (rloser k2 p2 v2 t1 m1 t2) m2 t3-    | otherwise = lloser k2 p2 v2 (lloser k1 p1 v1 t1 m1 t2) m2 t3-lsingleLeft k1 p1 v1 t1 m1 (RLoser _ (E k2 p2 v2) t2 m2 t3) =-    rloser k2 p2 v2 (lloser k1 p1 v1 t1 m1 t2) m2 t3-lsingleLeft _ _ _ _ _ _ = moduleError "lsingleLeft" "malformed tree" -rsingleLeft :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-rsingleLeft k1 p1 v1 t1 m1 (LLoser _ (E k2 p2 v2) t2 m2 t3) =-    rloser k1 p1 v1 (rloser k2 p2 v2 t1 m1 t2) m2 t3-rsingleLeft k1 p1 v1 t1 m1 (RLoser _ (E k2 p2 v2) t2 m2 t3) =-    rloser k2 p2 v2 (rloser k1 p1 v1 t1 m1 t2) m2 t3-rsingleLeft _ _ _ _ _ _ = moduleError "rsingleLeft" "malformed tree"+adjust+    :: (Prio -> Prio)+    -> Key+    -> PSQ a+    -> PSQ a+adjust f k q = case alter g k q of (_, q') -> q'+  where g (Just (p, v)) = ((), Just ((f p), v))+        g Nothing       = ((), Nothing) -lsingleRight :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-lsingleRight k1 p1 v1 (LLoser _ (E k2 p2 v2) t1 m1 t2) m2 t3 =-    lloser k2 p2 v2 t1 m1 (lloser k1 p1 v1 t2 m2 t3)-lsingleRight k1 p1 v1 (RLoser _ (E k2 p2 v2) t1 m1 t2) m2 t3 =-    lloser k1 p1 v1 t1 m1 (lloser k2 p2 v2 t2 m2 t3)-lsingleRight _ _ _ _ _ _ = moduleError "lsingleRight" "malformed tree"+{-# INLINE adjust #-} -rsingleRight :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-rsingleRight k1 p1 v1 (LLoser _ (E k2 p2 v2) t1 m1 t2) m2 t3 =-    lloser k2 p2 v2 t1 m1 (rloser k1 p1 v1 t2 m2 t3)-rsingleRight k1 p1 v1 (RLoser _ (E k2 p2 v2) t1 m1 t2) m2 t3-    | p1 <= p2  = rloser k1 p1 v1 t1 m1 (lloser k2 p2 v2 t2 m2 t3)-    | otherwise = rloser k2 p2 v2 t1 m1 (rloser k1 p1 v1 t2 m2 t3)-rsingleRight _ _ _ _ _ _ = moduleError "rsingleRight" "malformed tree"+-- | /O(min(n,W))/ The expression @alter f k queue@ alters the value @x@ at @k@,+-- or absence thereof. 'alter' can be used to insert, delete, or update a value+-- in a queue. It also allows you to calculate an additional value @b@.+{-# INLINE alter #-}+alter+    :: (Maybe (Prio, v) -> (b, Maybe (Prio, v)))+    -> Key+    -> IntPSQ v+    -> (b, IntPSQ v)+alter f = \k t0 ->+    let (t, mbX) = case deleteView k t0 of+                            Nothing          -> (t0, Nothing)+                            Just (p, v, t0') -> (t0', Just (p, v))+    in case f mbX of+          (b, mbX') ->+            (b, maybe t (\(p, v) -> unsafeInsertNew k p v t) mbX')+    where+        maybe _ g (Just x)  = g x+        maybe def _ Nothing = def -ldoubleLeft :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-ldoubleLeft k1 p1 v1 t1 m1 (LLoser _ (E k2 p2 v2) t2 m2 t3) =-    lsingleLeft k1 p1 v1 t1 m1 (lsingleRight k2 p2 v2 t2 m2 t3)-ldoubleLeft k1 p1 v1 t1 m1 (RLoser _ (E k2 p2 v2) t2 m2 t3) =-    lsingleLeft k1 p1 v1 t1 m1 (rsingleRight k2 p2 v2 t2 m2 t3)-ldoubleLeft _ _ _ _ _ _ = moduleError "ldoubleLeft" "malformed tree"+-- | Smart constructor for a 'Bin' node whose left subtree could have become+-- 'Nil'.+{-# INLINE binShrinkL #-}+binShrinkL :: Key -> Prio -> v -> Mask -> IntPSQ v -> IntPSQ v -> IntPSQ v+binShrinkL k p x m Nil r = case r of Nil -> Tip k p x; _ -> Bin k p x m Nil r+binShrinkL k p x m l   r = Bin k p x m l r -ldoubleRight :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-ldoubleRight k1 p1 v1 (LLoser _ (E k2 p2 v2) t1 m1 t2) m2 t3 =-    lsingleRight k1 p1 v1 (lsingleLeft k2 p2 v2 t1 m1 t2) m2 t3-ldoubleRight k1 p1 v1 (RLoser _ (E k2 p2 v2) t1 m1 t2) m2 t3 =-    lsingleRight k1 p1 v1 (rsingleLeft k2 p2 v2 t1 m1 t2) m2 t3-ldoubleRight _ _ _ _ _ _ = moduleError "ldoubleRight" "malformed tree"+-- | Smart constructor for a 'Bin' node whose right subtree could have become+-- 'Nil'.+{-# INLINE binShrinkR #-}+binShrinkR :: Key -> Prio -> v -> Mask -> IntPSQ v -> IntPSQ v -> IntPSQ v+binShrinkR k p x m l Nil = case l of Nil -> Tip k p x; _ -> Bin k p x m l Nil+binShrinkR k p x m l r   = Bin k p x m l r -rdoubleLeft :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-rdoubleLeft k1 p1 v1 t1 m1 (LLoser _ (E k2 p2 v2) t2 m2 t3) =-    rsingleLeft k1 p1 v1 t1 m1 (lsingleRight k2 p2 v2 t2 m2 t3)-rdoubleLeft k1 p1 v1 t1 m1 (RLoser _ (E k2 p2 v2) t2 m2 t3) =-    rsingleLeft k1 p1 v1 t1 m1 (rsingleRight k2 p2 v2 t2 m2 t3)-rdoubleLeft _ _ _ _ _ _ = moduleError "rdoubleLeft" "malformed tree"+------------------------------------------------------------------------------+-- Lists+------------------------------------------------------------------------------ -rdoubleRight :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a-rdoubleRight k1 p1 v1 (LLoser _ (E k2 p2 v2) t1 m1 t2) m2 t3 =-    rsingleRight k1 p1 v1 (lsingleLeft k2 p2 v2 t1 m1 t2) m2 t3-rdoubleRight k1 p1 v1 (RLoser _ (E k2 p2 v2) t1 m1 t2) m2 t3 =-    rsingleRight k1 p1 v1 (rsingleLeft k2 p2 v2 t1 m1 t2) m2 t3-rdoubleRight _ _ _ _ _ _ = moduleError "rdoubleRight" "malformed tree"+-- | /O(n*min(n,W))/ Build a queue from a list of (key, priority, value) tuples.+-- If the list contains more than one priority and value for the same key, the+-- last priority and value for the key is retained.+{-# INLINABLE fromList #-}+fromList :: [Elem v] -> IntPSQ v+fromList = foldr (\(E k p x) im -> insert k p x im) empty --- | Take two pennants and returns a new pennant that is the union of--- the two with the precondition that the keys in the first tree are--- strictly smaller than the keys in the second tree.-play :: PSQ a -> PSQ a -> PSQ a-Void `play` t' = t'-t `play` Void  = t-Winner e@(E k p v) t m `play` Winner e'@(E k' p' v') t' m'-    | p <= p'   = Winner e (rbalance k' p' v' t m t') m'-    | otherwise = Winner e' (lbalance k p v t m t') m'-{-# INLINE play #-}+-- | /O(n)/ Convert a queue to a list of (key, priority, value) tuples. The+-- order of the list is not specified.+toList :: IntPSQ v -> [Elem v]+toList =+    go []+  where+    go acc Nil                   = acc+    go acc (Tip k' p' x')        = (E k' p' x') : acc+    go acc (Bin k' p' x' _m l r) = (E k' p' x') : go (go acc r) l --- | A version of 'play' that can be used if the shape of the tree has--- not changed or if the tree is known to be balanced.-unsafePlay :: PSQ a -> PSQ a -> PSQ a-Void `unsafePlay` t' =  t'-t `unsafePlay` Void  =  t-Winner e@(E k p v) t m `unsafePlay` Winner e'@(E k' p' v') t' m'-    | p <= p'   = Winner e (rloser k' p' v' t m t') m'-    | otherwise = Winner e' (lloser k p v t m t') m'-{-# INLINE unsafePlay #-} -data TourView a = Null-                | Single {-# UNPACK #-} !(Elem a)-                | (PSQ a) `Play` (PSQ a)+------------------------------------------------------------------------------+-- Views+------------------------------------------------------------------------------ -tourView :: PSQ a -> TourView a-tourView Void               = Null-tourView (Winner e Start _) = Single e-tourView (Winner e (RLoser _ e' tl m tr) m') =-    Winner e tl m `Play` Winner e' tr m'-tourView (Winner e (LLoser _ e' tl m tr) m') =-    Winner e' tl m `Play` Winner e tr m'+-- | /O(min(n,W))/ Delete a key and its priority and value from the queue. If+-- the key was present, the associated priority and value are returned in+-- addition to the updated queue.+{-# INLINABLE deleteView #-}+deleteView :: Key -> IntPSQ v -> Maybe (Prio, v, IntPSQ v)+deleteView k t0 =+    case delFrom t0 of+      (# _, Nothing     #) -> Nothing+      (# t, Just (p, x) #) -> Just (p, x, t)+  where+    delFrom t = case t of+      Nil -> (# Nil, Nothing #) ---------------------------------------------------------------------------- Utility functions+      Tip k' p' x'+        | k == k'   -> (# Nil, Just (p', x') #)+        | otherwise -> (# t,   Nothing       #) -moduleError :: String -> String -> a-moduleError fun msg = errorWithoutStackTrace ("GHC.Event.PSQ." ++ fun ++ ':' : ' ' : msg)-{-# NOINLINE moduleError #-}+      Bin k' p' x' m l r+        | nomatch k k' m -> (# t, Nothing #)+        | k == k'   -> let t' = merge m l r+                       in  t' `seq` (# t', Just (p', x') #) ---------------------------------------------------------------------------- Hughes's efficient sequence type+        | zero k m  -> case delFrom l of+                         (# l', mbPX #) -> let t' = binShrinkL k' p' x' m l' r+                                           in  t' `seq` (# t', mbPX #) -newtype Sequ a = Sequ ([a] -> [a])+        | otherwise -> case delFrom r of+                         (# r', mbPX #) -> let t' = binShrinkR k' p' x' m l  r'+                                           in  t' `seq` (# t', mbPX #) -emptySequ :: Sequ a-emptySequ = Sequ (\as -> as)+-- | /O(min(n,W))/ Retrieve the binding with the least priority, and the+-- rest of the queue stripped of that binding.+{-# INLINE minView #-}+minView :: IntPSQ v -> Maybe (Elem v, IntPSQ v)+minView t = case t of+    Nil             -> Nothing+    Tip k p x       -> Just (E k p x, Nil)+    Bin k p x m l r -> Just (E k p x, merge m l r) -singleSequ :: a -> Sequ a-singleSequ a = Sequ (\as -> a : as)+-- | Return a list of elements ordered by key whose priorities are at most @pt@,+-- and the rest of the queue stripped of these elements.  The returned list of+-- elements can be in any order: no guarantees there.+{-# INLINABLE atMost #-}+atMost :: Prio -> IntPSQ v -> ([Elem v], IntPSQ v)+atMost pt t0 = go [] t0+  where+    go acc t = case t of+        Nil             -> (acc, t)+        Tip k p x+            | p > pt    -> (acc, t)+            | otherwise -> ((E k p x) : acc, Nil) -(<>) :: Sequ a -> Sequ a -> Sequ a-Sequ x1 <> Sequ x2 = Sequ (\as -> x1 (x2 as))-infixr 5 <>+        Bin k p x m l r+            | p > pt    -> (acc, t)+            | otherwise ->+                let (acc',  l') = go acc  l+                    (acc'', r') = go acc' r+                in  ((E k p x) : acc'', merge m l' r') -seqToList :: Sequ a -> [a]-seqToList (Sequ x) = x [] --- | @since 4.3.1.0-instance Show a => Show (Sequ a) where-    showsPrec d a = showsPrec d (seqToList a)+------------------------------------------------------------------------------+-- Traversal+------------------------------------------------------------------------------ +-- | Internal function that merges two *disjoint* 'IntPSQ's that share the+-- same prefix mask.+{-# INLINABLE merge #-}+merge :: Mask -> IntPSQ v -> IntPSQ v -> IntPSQ v+merge m l r = case l of+    Nil -> r++    Tip lk lp lx ->+      case r of+        Nil                     -> l+        Tip rk rp rx+          | (lp, lk) < (rp, rk) -> Bin lk lp lx m Nil r+          | otherwise           -> Bin rk rp rx m l   Nil+        Bin rk rp rx rm rl rr+          | (lp, lk) < (rp, rk) -> Bin lk lp lx m Nil r+          | otherwise           -> Bin rk rp rx m l   (merge rm rl rr)++    Bin lk lp lx lm ll lr ->+      case r of+        Nil                     -> l+        Tip rk rp rx+          | (lp, lk) < (rp, rk) -> Bin lk lp lx m (merge lm ll lr) r+          | otherwise           -> Bin rk rp rx m l                Nil+        Bin rk rp rx rm rl rr+          | (lp, lk) < (rp, rk) -> Bin lk lp lx m (merge lm ll lr) r+          | otherwise           -> Bin rk rp rx m l                (merge rm rl rr)
GHC/Event/Poll.hsc view
@@ -35,7 +35,7 @@ import GHC.Conc.Sync (withMVar) import GHC.Enum (maxBound) import GHC.Num (Num(..))-import GHC.Real (ceiling, fromIntegral)+import GHC.Real (fromIntegral, div) import GHC.Show (Show) import System.Posix.Types (Fd(..)) @@ -143,7 +143,9 @@  fromTimeout :: E.Timeout -> Int fromTimeout E.Forever     = -1-fromTimeout (E.Timeout s) = ceiling $ 1000 * s+fromTimeout (E.Timeout s) = fromIntegral $ s `divRoundUp` 1000000+  where+    divRoundUp num denom = (num + denom - 1) `div` denom  data PollFd = PollFd {       pfdFd      :: {-# UNPACK #-} !Fd@@ -156,7 +158,7 @@  -- We have to duplicate the whole enum like this in order for the -- hsc2hs cross-compilation mode to work-#ifdef POLLRDHUP+#if defined(POLLRDHUP) #{enum Event, Event  , pollIn    = POLLIN  , pollOut   = POLLOUT
GHC/Event/TimerManager.hs view
@@ -43,11 +43,11 @@ import Data.IORef (IORef, atomicModifyIORef', mkWeakIORef, newIORef, readIORef,                    writeIORef) import GHC.Base+import GHC.Clock (getMonotonicTimeNSec) import GHC.Conc.Signal (runHandlers) import GHC.Num (Num(..))-import GHC.Real ((/), fromIntegral )+import GHC.Real (fromIntegral) import GHC.Show (Show(..))-import GHC.Event.Clock (getMonotonicTime) import GHC.Event.Control import GHC.Event.Internal (Backend, Event, evtRead, Timeout(..)) import GHC.Event.Unique (Unique, UniqueSource, newSource, newUnique)@@ -186,7 +186,7 @@   -- next timeout.   mkTimeout :: IO Timeout   mkTimeout = do-      now <- getMonotonicTime+      now <- getMonotonicTimeNSec       (expired, timeout) <- atomicModifyIORef' (emTimeouts mgr) $ \tq ->            let (expired, tq') = Q.atMost now tq                timeout = case Q.minView tq' of@@ -215,29 +215,40 @@   !key <- newUnique (emUniqueSource mgr)   if us <= 0 then cb     else do-      now <- getMonotonicTime-      let expTime = fromIntegral us / 1000000.0 + now+      now <- getMonotonicTimeNSec+      let expTime = fromIntegral us * 1000 + now        editTimeouts mgr (Q.insert key expTime cb)-      wakeManager mgr   return $ TK key  -- | Unregister an active timeout. unregisterTimeout :: TimerManager -> TimeoutKey -> IO () unregisterTimeout mgr (TK key) = do   editTimeouts mgr (Q.delete key)-  wakeManager mgr  -- | Update an active timeout to fire in the given number of -- microseconds. updateTimeout :: TimerManager -> TimeoutKey -> Int -> IO () updateTimeout mgr (TK key) us = do-  now <- getMonotonicTime-  let expTime = fromIntegral us / 1000000.0 + now+  now <- getMonotonicTimeNSec+  let expTime = fromIntegral us * 1000 + now    editTimeouts mgr (Q.adjust (const expTime) key)-  wakeManager mgr  editTimeouts :: TimerManager -> TimeoutEdit -> IO ()-editTimeouts mgr g = atomicModifyIORef' (emTimeouts mgr) $ \tq -> (g tq, ())-+editTimeouts mgr g = do+  wake <- atomicModifyIORef' (emTimeouts mgr) f+  when wake (wakeManager mgr)+  where+    f q = (q', wake)+      where+        q' = g q+        wake = case Q.minView q of+                Nothing -> True+                Just (Q.E _ t0 _, _) ->+                  case Q.minView q' of+                    Just (Q.E _ t1 _, _) ->+                      -- don't wake the manager if the+                      -- minimum element didn't change.+                      t0 /= t1+                    _ -> True
GHC/Exception.hs view
@@ -130,13 +130,13 @@ @SomeCompilerException@, but not other types, e.g. @IOException@:  @-*Main> throw MismatchedParentheses `catch` \e -> putStrLn (\"Caught \" ++ show (e :: MismatchedParentheses))+*Main> throw MismatchedParentheses \`catch\` \\e -> putStrLn (\"Caught \" ++ show (e :: MismatchedParentheses)) Caught MismatchedParentheses-*Main> throw MismatchedParentheses `catch` \e -> putStrLn (\"Caught \" ++ show (e :: SomeFrontendException))+*Main> throw MismatchedParentheses \`catch\` \\e -> putStrLn (\"Caught \" ++ show (e :: SomeFrontendException)) Caught MismatchedParentheses-*Main> throw MismatchedParentheses `catch` \e -> putStrLn (\"Caught \" ++ show (e :: SomeCompilerException))+*Main> throw MismatchedParentheses \`catch\` \\e -> putStrLn (\"Caught \" ++ show (e :: SomeCompilerException)) Caught MismatchedParentheses-*Main> throw MismatchedParentheses `catch` \e -> putStrLn (\"Caught \" ++ show (e :: IOException))+*Main> throw MismatchedParentheses \`catch\` \\e -> putStrLn (\"Caught \" ++ show (e :: IOException)) *** Exception: MismatchedParentheses @ @@ -167,8 +167,8 @@ throw :: Exception e => e -> a throw e = raise# (toException e) --- |This is thrown when the user calls 'error'. The @String@ is the--- argument given to 'error'.+-- | This is thrown when the user calls 'error'. The first @String@ is the+-- argument given to 'error', second @String@ is the location. data ErrorCall = ErrorCallWithLocation String String     deriving (Eq, Ord) 
GHC/Exts.hs view
@@ -194,6 +194,15 @@   fromList = id   toList = id +-- | @since 4.9.0.0+instance IsList (NonEmpty a) where+  type Item (NonEmpty a) = a++  fromList (a:as) = a :| as+  fromList [] = errorWithoutStackTrace "NonEmpty.fromList: empty list"++  toList ~(a :| as) = a : as+ -- | @since 4.8.0.0 instance IsList Version where   type (Item Version) = Int
GHC/Float.hs view
@@ -1,8 +1,10 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE CPP+           , GHCForeignImportPrim            , NoImplicitPrelude            , MagicHash            , UnboxedTuples+           , UnliftedFFITypes   #-} {-# LANGUAGE CApiFFI #-} -- We believe we could deorphan this module, by moving lots of things@@ -21,11 +23,13 @@ -- Stability   :  internal -- Portability :  non-portable (GHC Extensions) ----- The types 'Float' and 'Double', and the classes 'Floating' and 'RealFloat'.+-- The types 'Float' and 'Double', the classes 'Floating' and 'RealFloat' and+-- casting between Word32 and Float and Word64 and Double. -- -----------------------------------------------------------------------------  #include "ieee-flpt.h"+#include "MachDeps.h"  module GHC.Float    ( module GHC.Float@@ -46,6 +50,7 @@ import GHC.Show import GHC.Num import GHC.Real+import GHC.Word import GHC.Arr import GHC.Float.RealFracMethods import GHC.Float.ConversionUtils@@ -1253,3 +1258,87 @@ -} clamp :: Int -> Int -> Int clamp bd k = max (-bd) (min bd k)+++{-+Note [Casting from integral to floating point types]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+To implement something like `reinterpret_cast` from C++ to go from a+floating-point type to an integral type one might niavely think that the+following should work:++      cast :: Float -> Word32+      cast (F# f#) = W32# (unsafeCoerce# f#)++Unfortunately that is not the case, because all the `unsafeCoerce#` does is tell+the compiler that the types have changed. When one does the above cast and+tries to operate on the resulting `Word32` the code generator will generate code+that performs an integer/word operation on a floating-point register, which+results in a compile error.++The correct way of implementing `reinterpret_cast` to implement a primpop, but+that requires a unique implementation for all supported archetectures. The next+best solution is to write the value from the source register to memory and then+read it from memory into the destination register and the best way to do that+is using CMM.+-}++-- | @'castWord32ToFloat' w@ does a bit-for-bit copy from an integral value+-- to a floating-point value.+--+-- @since 4.10.0.0++{-# INLINE castWord32ToFloat #-}+castWord32ToFloat :: Word32 -> Float+castWord32ToFloat (W32# w#) = F# (stgWord32ToFloat w#)++foreign import prim "stg_word32ToFloatzh"+    stgWord32ToFloat :: Word# -> Float#+++-- | @'castFloatToWord32' f@ does a bit-for-bit copy from a floating-point value+-- to an integral value.+--+-- @since 4.10.0.0++{-# INLINE castFloatToWord32 #-}+castFloatToWord32 :: Float -> Word32+castFloatToWord32 (F# f#) = W32# (stgFloatToWord32 f#)++foreign import prim "stg_floatToWord32zh"+    stgFloatToWord32 :: Float# -> Word#++++-- | @'castWord64ToDouble' w@ does a bit-for-bit copy from an integral value+-- to a floating-point value.+--+-- @since 4.10.0.0++{-# INLINE castWord64ToDouble #-}+castWord64ToDouble :: Word64 -> Double+castWord64ToDouble (W64# w) = D# (stgWord64ToDouble w)++foreign import prim "stg_word64ToDoublezh"+#if WORD_SIZE_IN_BITS == 64+    stgWord64ToDouble :: Word# -> Double#+#else+    stgWord64ToDouble :: Word64# -> Double#+#endif+++-- | @'castFloatToWord32' f@ does a bit-for-bit copy from a floating-point value+-- to an integral value.+--+-- @since 4.10.0.0++{-# INLINE castDoubleToWord64 #-}+castDoubleToWord64 :: Double -> Word64+castDoubleToWord64 (D# d#) = W64# (stgDoubleToWord64 d#)++foreign import prim "stg_doubleToWord64zh"+#if WORD_SIZE_IN_BITS == 64+    stgDoubleToWord64 :: Double# -> Word#+#else+    stgDoubleToWord64 :: Double# -> Word64#+#endif
GHC/Foreign.hs view
@@ -49,7 +49,6 @@ -- Imports for the locale-encoding version of marshallers  import Data.Tuple (fst)-import Data.Maybe  import GHC.Show ( show ) 
GHC/Generics.hs view
@@ -1,23 +1,24 @@-{-# LANGUAGE CPP                    #-}-{-# LANGUAGE DataKinds              #-}-{-# LANGUAGE DeriveFunctor          #-}+{-# LANGUAGE CPP                        #-}+{-# LANGUAGE DataKinds                  #-}+{-# LANGUAGE DeriveFunctor              #-}+{-# LANGUAGE DeriveGeneric              #-}+{-# LANGUAGE EmptyDataDeriving          #-}+{-# LANGUAGE FlexibleContexts           #-}+{-# LANGUAGE FlexibleInstances          #-}+{-# LANGUAGE GADTs                      #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}-{-# LANGUAGE DeriveGeneric          #-}-{-# LANGUAGE FlexibleContexts       #-}-{-# LANGUAGE FlexibleInstances      #-}-{-# LANGUAGE GADTs                  #-}-{-# LANGUAGE KindSignatures         #-}-{-# LANGUAGE MagicHash              #-}-{-# LANGUAGE NoImplicitPrelude      #-}-{-# LANGUAGE PolyKinds              #-}-{-# LANGUAGE ScopedTypeVariables    #-}-{-# LANGUAGE StandaloneDeriving     #-}-{-# LANGUAGE Trustworthy            #-}-{-# LANGUAGE TypeFamilies           #-}-{-# LANGUAGE TypeInType             #-}-{-# LANGUAGE TypeOperators          #-}-{-# LANGUAGE TypeSynonymInstances   #-}-{-# LANGUAGE UndecidableInstances   #-}+{-# LANGUAGE KindSignatures             #-}+{-# LANGUAGE MagicHash                  #-}+{-# LANGUAGE NoImplicitPrelude          #-}+{-# LANGUAGE PolyKinds                  #-}+{-# LANGUAGE ScopedTypeVariables        #-}+{-# LANGUAGE StandaloneDeriving         #-}+{-# LANGUAGE Trustworthy                #-}+{-# LANGUAGE TypeFamilies               #-}+{-# LANGUAGE TypeInType                 #-}+{-# LANGUAGE TypeOperators              #-}+{-# LANGUAGE TypeSynonymInstances       #-}+{-# LANGUAGE UndecidableInstances       #-}  ----------------------------------------------------------------------------- -- |@@ -256,9 +257,9 @@ -- all the constructors and fields as needed. However, users /should not rely on -- a specific nesting strategy/ for ':+:' and ':*:' being used. The compiler is -- free to choose any nesting it prefers. (In practice, the current implementation--- tries to produce a more or less balanced nesting, so that the traversal of the--- structure of the datatype from the root to a particular component can be performed--- in logarithmic rather than linear time.)+-- tries to produce a more-or-less balanced nesting, so that the traversal of+-- the structure of the datatype from the root to a particular component can be+-- performed in logarithmic rather than linear time.)  -- ** Defining datatype-generic functions --@@ -351,6 +352,14 @@ --   encode' ('R1' x) = True  : encode' x -- @ --+-- (Note that this encoding strategy may not be reliable across different+-- versions of GHC. Recall that the compiler is free to choose any nesting+-- of ':+:' it chooses, so if GHC chooses @(a ':+:' b) ':+:' c@, then the+-- encoding for @a@ would be @[False, False]@, @b@ would be @[False, True]@,+-- and @c@ would be @[True]@. However, if GHC chooses @a ':+:' (b ':+:' c)@,+-- then the encoding for @a@ would be @[False]@, @b@ would be @[True, False]@,+-- and @c@ would be @[True, True]@.)+-- -- In the case for ':*:', we append the encodings of the two subcomponents: -- -- @@@ -731,10 +740,10 @@ -- Needed for instances import GHC.Arr     ( Ix ) import GHC.Base    ( Alternative(..), Applicative(..), Functor(..)-                   , Monad(..), MonadPlus(..), String, coerce )+                   , Monad(..), MonadPlus(..), NonEmpty(..), String, coerce ) import GHC.Classes ( Eq(..), Ord(..) ) import GHC.Enum    ( Bounded, Enum )-import GHC.Read    ( Read(..), lex, readParen )+import GHC.Read    ( Read(..) ) import GHC.Show    ( Show(..), showString )  -- Needed for metadata@@ -747,12 +756,14 @@  -- | Void: used for datatypes without constructors data V1 (p :: k)-  deriving (Functor, Generic, Generic1)--deriving instance Eq   (V1 p)-deriving instance Ord  (V1 p)-deriving instance Read (V1 p)-deriving instance Show (V1 p)+  deriving ( Eq       -- ^ @since 4.9.0.0+           , Ord      -- ^ @since 4.9.0.0+           , Read     -- ^ @since 4.9.0.0+           , Show     -- ^ @since 4.9.0.0+           , Functor  -- ^ @since 4.9.0.0+           , Generic  -- ^ @since 4.9.0.0+           , Generic1 -- ^ @since 4.9.0.0+           )  -- | Unit: used for constructors without arguments data U1 (p :: k) = U1@@ -767,8 +778,7 @@   compare _ _ = EQ  -- | @since 4.9.0.0-instance Read (U1 p) where-  readsPrec d = readParen (d > 10) (\r -> [(U1, s) | ("U1",s) <- lex r ])+deriving instance Read (U1 p)  -- | @since 4.9.0.0 instance Show (U1 p) where@@ -1140,8 +1150,15 @@   selSourceStrictness   _ = fromSing (sing :: Sing ss)   selDecidedStrictness  _ = fromSing (sing :: Sing ds) --- | Representable types of kind *.--- This class is derivable in GHC with the DeriveGeneric flag on.+-- | Representable types of kind @*@.+-- This class is derivable in GHC with the @DeriveGeneric@ flag on.+--+-- A 'Generic' instance must satisfy the following laws:+--+-- @+-- 'from' . 'to' ≡ 'id'+-- 'to' . 'from' ≡ 'id'+-- @ class Generic a where   -- | Generic representation type   type Rep a :: * -> *@@ -1154,6 +1171,13 @@ -- | Representable types of kind @* -> *@ (or kind @k -> *@, when @PolyKinds@ -- is enabled). -- This class is derivable in GHC with the @DeriveGeneric@ flag on.+--+-- A 'Generic1' instance must satisfy the following laws:+--+-- @+-- 'from1' . 'to1' ≡ 'id'+-- 'to1' . 'from1' ≡ 'id'+-- @ class Generic1 (f :: k -> *) where   -- | Generic representation type   type Rep1 f :: k -> *@@ -1192,6 +1216,7 @@ --------------------------------------------------------------------------------  deriving instance Generic [a]+deriving instance Generic (NonEmpty a) deriving instance Generic (Maybe a) deriving instance Generic (Either a b) deriving instance Generic Bool@@ -1206,6 +1231,7 @@ deriving instance Generic ((,,,,,,) a b c d e f g)  deriving instance Generic1 []+deriving instance Generic1 NonEmpty deriving instance Generic1 Maybe deriving instance Generic1 (Either a) deriving instance Generic1 Proxy
GHC/IO/Buffer.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Trustworthy, BangPatterns #-} {-# LANGUAGE CPP, NoImplicitPrelude #-} {-# OPTIONS_GHC -funbox-strict-fields #-} @@ -101,7 +101,7 @@ writeWord8Buf :: RawBuffer Word8 -> Int -> Word8 -> IO () writeWord8Buf arr ix w = withForeignPtr arr $ \p -> pokeByteOff p ix w -#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16) type CharBufElem = Word16 #else type CharBufElem = Char@@ -124,7 +124,7 @@  {-# INLINE readCharBufPtr #-} readCharBufPtr :: Ptr CharBufElem -> Int -> IO (Char, Int)-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16) readCharBufPtr p ix = do   c1 <- peekElemOff p ix   if (c1 < 0xd800 || c1 > 0xdbff)@@ -138,7 +138,7 @@  {-# INLINE writeCharBufPtr #-} writeCharBufPtr :: Ptr CharBufElem -> Int -> Char -> IO Int-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16) writeCharBufPtr p ix ch   | c < 0x10000 = do pokeElemOff p ix (fromIntegral c)                      return (ix+1)@@ -153,7 +153,7 @@ #endif  charSize :: Int-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16) charSize = 2 #else charSize = 4@@ -186,7 +186,7 @@         bufR     :: !Int           -- offset of last item + 1   } -#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16) type CharBuffer = Buffer Word16 #else type CharBuffer = Buffer Char@@ -208,7 +208,7 @@  -- if a Char buffer does not have room for a surrogate pair, it is "full" isFullCharBuffer :: Buffer e -> Bool-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16) isFullCharBuffer buf = bufferAvailable buf < 2 #else isFullCharBuffer = isFullBuffer@@ -264,7 +264,8 @@    memmove :: Ptr a -> Ptr a -> CSize -> IO (Ptr a)  summaryBuffer :: Buffer a -> String-summaryBuffer buf = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-" ++ show (bufR buf) ++ ")"+summaryBuffer !buf  -- Strict => slightly better code+   = "buf" ++ show (bufSize buf) ++ "(" ++ show (bufL buf) ++ "-" ++ show (bufR buf) ++ ")"  -- INVARIANTS on Buffers: --   * r <= w
GHC/IO/Encoding.hs view
@@ -27,6 +27,7 @@         setLocaleEncoding, setFileSystemEncoding, setForeignEncoding,         char8,         mkTextEncoding,+        argvEncoding     ) where  import GHC.Base@@ -159,6 +160,17 @@ initLocaleEncoding     = CodePage.localeEncoding initFileSystemEncoding = CodePage.mkLocaleEncoding RoundtripFailure initForeignEncoding    = CodePage.mkLocaleEncoding IgnoreCodingFailure+#endif++-- See Note [Windows Unicode Arguments] in rts/RtsFlags.c+-- On Windows we assume hs_init argv is in utf8 encoding.++-- | Internal encoding of argv+argvEncoding :: IO TextEncoding+#if defined(mingw32_HOST_OS)+argvEncoding = return utf8+#else+argvEncoding = getFileSystemEncoding #endif  -- | An encoding in which Unicode code points are translated to bytes
GHC/IO/Encoding/CodePage.hs view
@@ -32,7 +32,7 @@ import GHC.IO.Encoding.UTF16 (mkUTF16le, mkUTF16be) import GHC.IO.Encoding.UTF32 (mkUTF32le, mkUTF32be) -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) # if defined(i386_HOST_ARCH) #  define WINDOWS_CCONV stdcall # elif defined(x86_64_HOST_ARCH)
GHC/IO/Encoding/CodePage/API.hs view
@@ -157,7 +157,7 @@  utf16_native_encode' :: EncodeBuffer utf16_native_decode' :: DecodeBuffer-#ifdef WORDS_BIGENDIAN+#if defined(WORDS_BIGENDIAN) utf16_native_encode' = utf16be_encode utf16_native_decode' = utf16be_decode #else@@ -204,7 +204,7 @@  cpDecode :: Word32 -> Int -> DecodeBuffer cpDecode cp max_char_size = \ibuf obuf -> do-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16)     let mbuf = obuf #else     -- FIXME: share the buffer between runs, even if the buffer is not the perfect size@@ -215,7 +215,7 @@     debugIO $ "cpDecode " ++ summaryBuffer ibuf ++ " " ++ summaryBuffer mbuf     (why1, ibuf', mbuf') <- cpRecode try' is_valid_prefix max_char_size 1 0 1 ibuf mbuf     debugIO $ "cpRecode (cpDecode) = " ++ show why1 ++ " " ++ summaryBuffer ibuf' ++ " " ++ summaryBuffer mbuf'-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16)     return (why1, ibuf', mbuf') #else     -- Convert as much UTF-16 as possible to UTF-32. Note that it's impossible for this to fail@@ -265,7 +265,7 @@  cpEncode :: Word32 -> Int -> EncodeBuffer cpEncode cp _max_char_size = \ibuf obuf -> do-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16)     let mbuf' = ibuf #else     -- FIXME: share the buffer between runs, even though that means we can't size the buffer as we want.@@ -281,11 +281,11 @@     debugIO $ "\ncpEncode " ++ summaryBuffer mbuf' ++ " " ++ summaryBuffer obuf     (why2, target_utf16_count, mbuf', obuf) <- saner (cpRecode try' is_valid_prefix 2 1 1 0) (mbuf' { bufState = ReadBuffer }) obuf     debugIO $ "cpRecode (cpEncode) = " ++ show why2 ++ " " ++ summaryBuffer mbuf' ++ " " ++ summaryBuffer obuf-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16)     return (why2, mbuf', obuf) #else     case why2 of-      -- If we succesfully translate all of the UTF-16 buffer, we need to know why+      -- If we successfully translate all of the UTF-16 buffer, we need to know why       -- we weren't able to get any more UTF-16 out of the UTF-32 buffer       InputUnderflow | isEmptyBuffer mbuf' -> return (why1, ibuf', obuf)                      | otherwise           -> errorWithoutStackTrace "cpEncode: impossible underflown UTF-16 buffer"@@ -361,7 +361,7 @@       --       -- Luckily if we have InvalidSequence/OutputUnderflow and we do not appear to have reached       -- the target, what we should do is the same as normal because the fraction of ibuf that our-      -- first "code" coded succesfully must be invalid-sequence-free, and ibuf will always+      -- first "code" coded successfully must be invalid-sequence-free, and ibuf will always       -- have been decoded as far as the first invalid sequence in it.       case bufferElems mbuf `compare` target_to_elems of         -- Coding n "from" chars from the input yields exactly as many "to" chars
GHC/IO/Encoding/Iconv.hs view
@@ -85,7 +85,7 @@     c_localeEncoding :: IO CString  haskellChar :: String-#ifdef WORDS_BIGENDIAN+#if defined(WORDS_BIGENDIAN) haskellChar | charSize == 2 = "UTF-16BE"             | otherwise     = "UTF-32BE" #else
GHC/IO/Exception.hs view
@@ -33,6 +33,7 @@    ArrayException(..),   ExitCode(..),+  FixIOException (..),    ioException,   ioError,@@ -267,6 +268,15 @@         = showString "undefined array element"         . (if not (null s) then showString ": " . showString s                            else id)++-- | @since TODO+data FixIOException = FixIOException++-- | @since TODO+instance Exception FixIOException++instance Show FixIOException where+  showsPrec _ FixIOException = showString "cyclic evaluation in fixIO"  -- ----------------------------------------------------------------------------- -- The ExitCode type
GHC/IO/FD.hs view
@@ -43,7 +43,7 @@ import GHC.IO.Device (SeekMode(..), IODeviceType(..)) import GHC.Conc.IO import GHC.IO.Exception-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) import GHC.Windows #endif @@ -53,7 +53,7 @@ import System.Posix.Internals hiding (FD, setEcho, getEcho) import System.Posix.Types -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) # if defined(i386_HOST_ARCH) #  define WINDOWS_CCONV stdcall # elif defined(x86_64_HOST_ARCH)@@ -71,7 +71,7 @@  data FD = FD {   fdFD :: {-# UNPACK #-} !CInt,-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   -- On Windows, a socket file descriptor needs to be read and written   -- using different functions (send/recv).   fdIsSocket_ :: {-# UNPACK #-} !Int@@ -83,7 +83,7 @@ #endif  } -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) fdIsSocket :: FD -> Bool fdIsSocket fd = fdIsSocket_ fd /= 0 #endif@@ -167,7 +167,7 @@                   ReadWriteMode -> rw_flags                   AppendMode    -> append_flags -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)       binary_flags = o_BINARY #else       binary_flags = 0@@ -179,14 +179,10 @@              | otherwise    = oflags2     in do -    -- the old implementation had a complicated series of three opens,-    -- which is perhaps because we have to be careful not to open-    -- directories.  However, the man pages I've read say that open()-    -- always returns EISDIR if the file is a directory and was opened-    -- for writing, so I think we're ok with a single open() here...-    fd <- throwErrnoIfMinus1Retry "openFile"-                (if non_blocking then c_open      f oflags 0o666-                                 else c_safe_open f oflags 0o666)+    -- NB. always use a safe open(), because we don't know whether open()+    -- will be fast or not.  It can be slow on NFS and FUSE filesystems,+    -- for example.+    fd <- throwErrnoIfMinus1Retry "openFile" $ c_safe_open f oflags 0o666      (fD,fd_type) <- mkFD fd iomode Nothing{-no stat-}                             False{-not a socket-}@@ -259,12 +255,12 @@          _other_type -> return () -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)     when (not is_socket) $ setmode fd True >> return () #endif      return (FD{ fdFD = fd,-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)                 fdIsNonBlocking = fromEnum is_nonblock #else                 fdIsSocket_ = fromEnum is_socket@@ -273,7 +269,7 @@             fd_type)  getUniqueFileInfo :: CInt -> CDev -> CIno -> IO (Word64, Word64)-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS) getUniqueFileInfo _ dev ino = return (fromIntegral dev, fromIntegral ino) #else getUniqueFileInfo fd _ _ = do@@ -283,7 +279,7 @@       liftM2 (,) (peek devptr) (peek inoptr) #endif -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) foreign import ccall unsafe "__hscore_setmode"   setmode :: CInt -> Bool -> IO CInt #endif@@ -293,7 +289,7 @@  stdFD :: CInt -> FD stdFD fd = FD { fdFD = fd,-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)                 fdIsSocket_ = 0 #else                 fdIsNonBlocking = 0@@ -315,7 +311,7 @@ close fd =   do let closer realFd =            throwErrnoIfMinus1Retry_ "GHC.IO.FD.close" $-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)            if fdIsSocket fd then              c_closesocket (fromIntegral realFd)            else@@ -333,7 +329,7 @@ release fd = do _ <- unlockFile (fdFD fd)                 return () -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) foreign import WINDOWS_CCONV unsafe "HsBase.h closesocket"    c_closesocket :: CInt -> IO CInt #endif@@ -405,7 +401,7 @@   return (toEnum (fromIntegral r))  foreign import ccall safe "fdReady"-  fdReady :: CInt -> CInt -> CInt -> CInt -> IO CInt+  fdReady :: CInt -> CInt -> Int64 -> CInt -> IO CInt  -- --------------------------------------------------------------------------- -- Terminal-related stuff@@ -465,7 +461,7 @@  -- Low level routines for reading/writing to (raw)buffers: -#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)  {- NOTE [nonblock]:@@ -566,7 +562,7 @@ isNonBlocking fd = fdIsNonBlocking fd /= 0  foreign import ccall unsafe "fdReady"-  unsafe_fdReady :: CInt -> CInt -> CInt -> CInt -> IO CInt+  unsafe_fdReady :: CInt -> CInt -> Int64 -> CInt -> IO CInt  #else /* mingw32_HOST_OS.... */ @@ -647,7 +643,7 @@ -- ----------------------------------------------------------------------------- -- utils -#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS) throwErrnoIfMinus1RetryOnBlock  :: String -> IO CSsize -> IO CSsize -> IO CSsize throwErrnoIfMinus1RetryOnBlock loc f on_block  =   do@@ -672,7 +668,7 @@ foreign import ccall unsafe "unlockFile"   unlockFile :: CInt -> IO CInt -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) foreign import ccall unsafe "get_unique_file_info"   c_getUniqueFileInfo :: CInt -> Ptr Word64 -> Ptr Word64 -> IO () #endif
GHC/IO/Handle.hs view
@@ -232,7 +232,7 @@           is_tty <- IODevice.isTerminal haDevice           when (is_tty && isReadableHandleType haType) $                 case mode of-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)         -- 'raw' mode under win32 is a bit too specialised (and troublesome         -- for most common uses), so simply disable its use here.                   NoBuffering -> IODevice.setRaw haDevice True
GHC/IO/Handle/FD.hs view
@@ -91,14 +91,14 @@ -- We have to put the FDs into binary mode on Windows to avoid the newline -- translation that the CRT IO library does. setBinaryMode :: FD.FD -> IO ()-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) setBinaryMode fd = do _ <- setmode (FD.fdFD fd) True                       return () #else setBinaryMode _ = return () #endif -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) foreign import ccall unsafe "__hscore_setmode"   setmode :: CInt -> Bool -> IO CInt #endif@@ -202,7 +202,7 @@  mkHandleFromFD fd0 fd_type filepath iomode set_non_blocking mb_codec   = do-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)     -- turn on non-blocking mode     fd <- if set_non_blocking               then FD.setNonBlockingMode fd0 True
GHC/IO/Handle/Lock.hsc view
@@ -8,6 +8,7 @@   , LockMode(..)   , hLock   , hTryLock+  , hUnlock   ) where  #include "HsBaseConfig.h"@@ -97,6 +98,10 @@ hTryLock :: Handle -> LockMode -> IO Bool hTryLock h mode = lockImpl h "hTryLock" mode False +-- | Release a lock taken with 'hLock' or 'hTryLock'.+hUnlock :: Handle -> IO ()+hUnlock = unlockImpl+ ----------------------------------------  #if HAVE_OFD_LOCKING@@ -186,6 +191,11 @@       SharedLock    -> #{const LOCK_SH}       ExclusiveLock -> #{const LOCK_EX} +unlockImpl :: Handle -> IO ()+unlockImpl h = do+  FD{fdFD = fd} <- handleToFd h+  throwErrnoIfMinus1_ "flock" $ c_flock fd #{const LOCK_UN}+ foreign import ccall interruptible "flock"   c_flock :: CInt -> CInt -> IO CInt @@ -201,9 +211,8 @@     -- We want to lock the whole file without looking up its size to be     -- consistent with what flock does. According to documentation of LockFileEx     -- "locking a region that goes beyond the current end-of-file position is-    -- not an error", however some versions of Windows seem to have issues with-    -- large regions and set ERROR_INVALID_LOCK_RANGE in such case for-    -- mysterious reasons. Work around that by setting only low 32 bits.+    -- not an error", hence we pass maximum value as the number of bytes to+    -- lock.     fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0xffffffff ovrlpd >>= \case       True  -> return True       False -> getLastError >>= \err -> if@@ -217,6 +226,18 @@       SharedLock    -> 0       ExclusiveLock -> #{const LOCKFILE_EXCLUSIVE_LOCK} +unlockImpl :: Handle -> IO ()+unlockImpl h = do+  FD{fdFD = fd} <- handleToFd h+  wh <- throwErrnoIf (== iNVALID_HANDLE_VALUE) "hUnlock" $ c_get_osfhandle fd+  allocaBytes sizeof_OVERLAPPED $ \ovrlpd -> do+    fillBytes ovrlpd 0 sizeof_OVERLAPPED+    c_UnlockFileEx wh 0 0xffffffff 0xffffffff ovrlpd >>= \case+      True  -> return ()+      False -> getLastError >>= failWith "hUnlock"+  where+    sizeof_OVERLAPPED = #{size OVERLAPPED}+ -- https://msdn.microsoft.com/en-us/library/aa297958.aspx foreign import ccall unsafe "_get_osfhandle"   c_get_osfhandle :: CInt -> IO HANDLE@@ -225,10 +246,18 @@ foreign import WINDOWS_CCONV interruptible "LockFileEx"   c_LockFileEx :: HANDLE -> DWORD -> DWORD -> DWORD -> DWORD -> Ptr () -> IO BOOL +-- https://msdn.microsoft.com/en-us/library/windows/desktop/aa365716.aspx+foreign import WINDOWS_CCONV interruptible "UnlockFileEx"+  c_UnlockFileEx :: HANDLE -> DWORD -> DWORD -> DWORD -> Ptr () -> IO BOOL+ #else  -- | No-op implementation. lockImpl :: Handle -> String -> LockMode -> Bool -> IO Bool lockImpl _ _ _ _ = throwIO FileLockingNotSupported++-- | No-op implementation.+unlockImpl :: Handle -> IO ()+unlockImpl _ = throwIO FileLockingNotSupported  #endif
GHC/IO/Handle/Text.hs view
@@ -271,7 +271,7 @@               -- Here, we are rather careful to only put an *evaluated* character               -- in the output string. Due to pointer tagging, this allows the consumer               -- to avoid ping-ponging between the actual consumer code and the thunk code-#ifdef CHARBUF_UTF16+#if defined(CHARBUF_UTF16)               -- reverse-order decoding of UTF-16               c2 <- peekElemOff pbuf i               if (c2 < 0xdc00 || c2 > 0xdffff)
GHC/IO/Handle/Types.hs view
@@ -46,7 +46,7 @@ import GHC.Word import GHC.IO.Device import Data.Typeable-#ifdef DEBUG+#if defined(DEBUG) import Control.Monad #endif @@ -179,7 +179,7 @@ --   * In a wriite Handle, the Char buffer is always empty (we encode when writing) -- checkHandleInvariants :: Handle__ -> IO ()-#ifdef DEBUG+#if defined(DEBUG) checkHandleInvariants h_ = do  bbuf <- readIORef (haByteBuffer h_)  checkBuffer bbuf@@ -367,7 +367,7 @@ -- | The native newline representation for the current platform: 'LF' -- on Unix systems, 'CRLF' on Windows. nativeNewline :: Newline-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) nativeNewline = CRLF #else nativeNewline = LF
GHC/IORef.hs view
@@ -31,11 +31,10 @@  -- |A mutable variable in the 'IO' monad newtype IORef a = IORef (STRef RealWorld a)---- explicit instance because Haddock can't figure out a derived one--- | @since 4.1.0.0-instance Eq (IORef a) where-  IORef x == IORef y = x == y+  deriving Eq+  -- ^ Pointer equality.+  --+  -- @since 4.1.0.0  -- |Build a new 'IORef' newIORef    :: a -> IO (IORef a)
GHC/List.hs view
@@ -23,7 +23,7 @@    map, (++), filter, concat,    head, last, tail, init, uncons, null, length, (!!),    foldl, foldl', foldl1, foldl1', scanl, scanl1, scanl', foldr, foldr1,-   scanr, scanr1, iterate, repeat, replicate, cycle,+   scanr, scanr1, iterate, iterate', repeat, replicate, cycle,    take, drop, sum, product, maximum, minimum, splitAt, takeWhile, dropWhile,    span, break, reverse, and, or,    any, all, elem, notElem, lookup,@@ -79,7 +79,7 @@  -- | Extract the last element of a list, which must be finite and non-empty. last                    :: [a] -> a-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) last [x]                =  x last (_:xs)             =  last xs last []                 =  errorEmptyList "last"@@ -98,7 +98,7 @@ -- | Return all the elements of a list except the last one. -- The list must be non-empty. init                    :: [a] -> [a]-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) init [x]                =  [] init (x:xs)             =  x : init xs init []                 =  errorEmptyList "init"@@ -203,13 +203,10 @@      in CoreArity.  The oneShot annotations used in this module are correct, as we only use them in-argumets to foldr, where we know how the arguments are called.--}+arguments to foldr, where we know how the arguments are called. -{- Note [Inline FB functions] ~~~~~~~~~~~~~~~~~~~~~~~~~~- After fusion rules successfully fire, we are usually left with one or more calls to list-producing functions abstracted over cons and nil. Here we call them FB functions because their names usually end with 'FB'. It's a good idea to@@ -445,7 +442,10 @@ -- of @f@ to @x@: -- -- > iterate f x == [x, f x, f (f x), ...]-+--+-- Note that 'iterate' is lazy, potentially leading to thunk build-up if+-- the consumer doesn't force each iterate. See 'iterate\'' for a strict+-- variant of this function. {-# NOINLINE [1] iterate #-} iterate :: (a -> a) -> a -> [a] iterate f x =  x : iterate f (f x)@@ -461,6 +461,29 @@  #-}  +-- | 'iterate\'' is the strict version of 'iterate'.+--+-- It ensures that the result of each application of force to weak head normal+-- form before proceeding.+{-# NOINLINE [1] iterate' #-}+iterate' :: (a -> a) -> a -> [a]+iterate' f x =+    let x' = f x+    in x' `seq` (x : iterate' f x')++{-# INLINE [0] iterate'FB #-} -- See Note [Inline FB functions]+iterate'FB :: (a -> b -> b) -> (a -> a) -> a -> b+iterate'FB c f x0 = go x0+  where go x =+            let x' = f x+            in x' `seq` (x `c` go x')++{-# RULES+"iterate'"    [~1] forall f x.   iterate' f x = build (\c _n -> iterate'FB c f x)+"iterate'FB"  [1]                iterate'FB (:) = iterate'+ #-}++ -- | 'repeat' @x@ is an infinite list, with @x@ the value of every element. repeat :: a -> [a] {-# INLINE [0] repeat #-}@@ -553,7 +576,7 @@ -- It is an instance of the more general 'Data.List.genericTake', -- in which @n@ may be of any integral type. take                   :: Int -> [a] -> [a]-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) take n _      | n <= 0 =  [] take _ []              =  [] take n (x:xs)          =  x : take (n-1) xs@@ -620,7 +643,7 @@ -- It is an instance of the more general 'Data.List.genericDrop', -- in which @n@ may be of any integral type. drop                   :: Int -> [a] -> [a]-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) drop n xs     | n <= 0 =  xs drop _ []              =  [] drop n (_:xs)          =  drop (n-1) xs@@ -655,7 +678,7 @@ -- in which @n@ may be of any integral type. splitAt                :: Int -> [a] -> ([a],[a]) -#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) splitAt n xs           =  (take n xs, drop n xs) #else splitAt n ls@@ -697,7 +720,7 @@ -- 'break' @p@ is equivalent to @'span' ('not' . p)@.  break                   :: (a -> Bool) -> [a] -> ([a],[a])-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) break p                 =  span (not . p) #else -- HBC version (stolen)@@ -710,7 +733,7 @@ -- | 'reverse' @xs@ returns the elements of @xs@ in reverse order. -- @xs@ must be finite. reverse                 :: [a] -> [a]-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) reverse                 =  foldl (flip (:)) [] #else reverse l =  rev l []@@ -723,7 +746,7 @@ -- 'True', the list must be finite; 'False', however, results from a 'False' -- value at a finite index of a finite or infinite list. and                     :: [Bool] -> Bool-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) and                     =  foldr (&&) True #else and []          =  True@@ -740,7 +763,7 @@ -- 'False', the list must be finite; 'True', however, results from a 'True' -- value at a finite index of a finite or infinite list. or                      :: [Bool] -> Bool-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) or                      =  foldr (||) False #else or []           =  False@@ -759,7 +782,7 @@ -- value for the predicate applied to an element at a finite index of a finite or infinite list. any                     :: (a -> Bool) -> [a] -> Bool -#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) any p                   =  or . map p #else any _ []        = False@@ -778,7 +801,7 @@ -- 'True', the list must be finite; 'False', however, results from a 'False' -- value for the predicate applied to an element at a finite index of a finite or infinite list. all                     :: (a -> Bool) -> [a] -> Bool-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) all p                   =  and . map p #else all _ []        =  True@@ -797,7 +820,7 @@ -- 'False', the list must be finite; 'True', however, results from an element -- equal to @x@ found at a finite index of a finite or infinite list. elem                    :: (Eq a) => a -> [a] -> Bool-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) elem x                  =  any (== x) #else elem _ []       = False@@ -811,7 +834,7 @@  -- | 'notElem' is the negation of 'elem'. notElem                 :: (Eq a) => a -> [a] -> Bool-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) notElem x               =  all (/= x) #else notElem _ []    =  True@@ -858,7 +881,7 @@ -- It is an instance of the more general 'Data.List.genericIndex', -- which takes an index of any integral type. (!!)                    :: [a] -> Int -> a-#ifdef USE_REPORT_PRELUDE+#if defined(USE_REPORT_PRELUDE) xs     !! n | n < 0 =  errorWithoutStackTrace "Prelude.!!: negative index" []     !! _         =  errorWithoutStackTrace "Prelude.!!: index too large" (x:_)  !! 0         =  x@@ -969,9 +992,11 @@ -- > zipWith f [] _|_ = [] {-# NOINLINE [1] zipWith #-} zipWith :: (a->b->c) -> [a]->[b]->[c]-zipWith _f []     _bs    = []-zipWith _f _as    []     = []-zipWith f  (a:as) (b:bs) = f a b : zipWith f as bs+zipWith f = go+  where+    go [] _ = []+    go _ [] = []+    go (x:xs) (y:ys) = f x y : go xs ys  -- zipWithFB must have arity 2 since it gets two arguments in the "zipWith" -- rule; it might not get inlined otherwise@@ -988,9 +1013,10 @@ -- elements, as well as three lists and returns a list of their point-wise -- combination, analogous to 'zipWith'. zipWith3                :: (a->b->c->d) -> [a]->[b]->[c]->[d]-zipWith3 z (a:as) (b:bs) (c:cs)-                        =  z a b c : zipWith3 z as bs cs-zipWith3 _ _ _ _        =  []+zipWith3 z = go+  where+    go (a:as) (b:bs) (c:cs) = z a b c : go as bs cs+    go _ _ _                = []  -- | 'unzip' transforms a list of pairs into a list of first components -- and a list of second components.
GHC/MVar.hs view
@@ -90,7 +90,7 @@ takeMVar (MVar mvar#) = IO $ \ s# -> takeMVar# mvar# s#  -- |Atomically read the contents of an 'MVar'.  If the 'MVar' is--- currently empty, 'readMVar' will wait until its full.+-- currently empty, 'readMVar' will wait until it is full. -- 'readMVar' is guaranteed to receive the next 'putMVar'. -- -- 'readMVar' is multiple-wakeup, so when multiple readers are
GHC/Natural.hs view
@@ -47,16 +47,10 @@  #include "MachDeps.h" -#if defined(MIN_VERSION_integer_gmp)-# define HAVE_GMP_BIGNAT MIN_VERSION_integer_gmp(1,0,0)-#else-# define HAVE_GMP_BIGNAT 0-#endif- import GHC.Arr import GHC.Base import {-# SOURCE #-} GHC.Exception (underflowException)-#if HAVE_GMP_BIGNAT+#if defined(MIN_VERSION_integer_gmp) import GHC.Integer.GMP.Internals import Data.Word import Data.Int@@ -87,14 +81,19 @@ -- Natural type ------------------------------------------------------------------------------- -#if HAVE_GMP_BIGNAT+#if defined(MIN_VERSION_integer_gmp) -- TODO: if saturated arithmetic is to used, replace 'underflowError' by '0'  -- | Type representing arbitrary-precision non-negative integers. ----- Operations whose result would be negative--- @'throw' ('Underflow' :: 'ArithException')@.+-- >>> 2^20 :: Natural+-- 1267650600228229401496703205376 --+-- Operations whose result would be negative @'throw' ('Underflow' :: 'ArithException')@,+--+-- >>> -1 :: Natural+-- *** Exception: arithmetic underflow+-- -- @since 4.8.0.0 data Natural = NatS#                 GmpLimb# -- ^ in @[0, maxBound::Word]@              | NatJ# {-# UNPACK #-} !BigNat   -- ^ in @]maxBound::Word, +inf[@@@ -344,13 +343,21 @@     testBit (NatS# w) i = testBit (W# w) i     testBit (NatJ# bn) (I# i#) = testBitBigNat bn i# -    -- TODO: setBit, clearBit, complementBit (needs more primitives)+    clearBit n@(NatS# w#) i+        | i < finiteBitSize (0::Word) = let !(W# w2#) = clearBit (W# w#) i in NatS# w2#+        | otherwise                   = n+    clearBit (NatJ# bn) (I# i#) = bigNatToNatural (clearBitBigNat bn i#) -    -- NB: We cannot use the default impl of 'clearBit' due to-    -- 'complement' not being well-defined for 'Natural' (c.f. #13203)-    clearBit x i | testBit x i = complementBit x i-                 | otherwise   = x+    setBit (NatS# w#) i@(I# i#)+        | i < finiteBitSize (0::Word) = let !(W# w2#) = setBit (W# w#) i in NatS# w2#+        | otherwise                   = bigNatToNatural (setBitBigNat (wordToBigNat w#) i#)+    setBit (NatJ# bn) (I# i#) = bigNatToNatural (setBitBigNat bn i#) +    complementBit (NatS# w#) i@(I# i#)+        | i < finiteBitSize (0::Word) = let !(W# w2#) = complementBit (W# w#) i in NatS# w2#+        | otherwise                   = bigNatToNatural (setBitBigNat (wordToBigNat w#) i#)+    complementBit (NatJ# bn) (I# i#) = bigNatToNatural (complementBitBigNat bn i#)+     shiftL n           0 = n     shiftL (NatS# 0##) _ = NatS# 0##     shiftL (NatS# 1##) i = bit i@@ -455,7 +462,7 @@ naturalToInt (NatS# w#) = I# (word2Int# w#) naturalToInt (NatJ# bn) = I# (bigNatToInt bn) -#else /* !HAVE_GMP_BIGNAT */+#else /* !defined(MIN_VERSION_integer_gmp) */ ---------------------------------------------------------------------------- -- Use wrapped 'Integer' as fallback; taken from Edward Kmett's nats package @@ -611,7 +618,7 @@ -- -- @since 4.8.0.0 wordToNatural :: Word -> Natural-#if HAVE_GMP_BIGNAT+#if defined(MIN_VERSION_integer_gmp) wordToNatural (W# w#) = NatS# w# #else wordToNatural w = Natural (fromIntegral w)@@ -622,7 +629,7 @@ -- -- @since 4.8.0.0 naturalToWordMaybe :: Natural -> Maybe Word-#if HAVE_GMP_BIGNAT+#if defined(MIN_VERSION_integer_gmp) naturalToWordMaybe (NatS# w#) = Just (W# w#) naturalToWordMaybe (NatJ# _)  = Nothing #else@@ -638,7 +645,7 @@ -- -- @since 4.8.0.0 powModNatural :: Natural -> Natural -> Natural -> Natural-#if HAVE_GMP_BIGNAT+#if defined(MIN_VERSION_integer_gmp) powModNatural _           _           (NatS# 0##) = divZeroError powModNatural _           _           (NatS# 1##) = NatS# 0## powModNatural _           (NatS# 0##) _           = NatS# 1##
GHC/RTS/Flags.hsc view
@@ -131,6 +131,9 @@ data MiscFlags = MiscFlags     { tickInterval          :: RtsTime     , installSignalHandlers :: Bool+    , installSEHHandlers    :: Bool+    , generateCrashDumpFile :: Bool+    , generateStackTrace    :: Bool     , machineReadable       :: Bool     , linkerMemBase         :: Word       -- ^ address to ask the OS for memory for the linker, 0 ==> off@@ -362,20 +365,27 @@           <*> #{peek GC_FLAGS, nurseryChunkSize} ptr           <*> #{peek GC_FLAGS, minOldGenSize} ptr           <*> #{peek GC_FLAGS, heapSizeSuggestion} ptr-          <*> #{peek GC_FLAGS, heapSizeSuggestionAuto} ptr+          <*> (toBool <$>+                (#{peek GC_FLAGS, heapSizeSuggestionAuto} ptr :: IO CBool))           <*> #{peek GC_FLAGS, oldGenFactor} ptr           <*> #{peek GC_FLAGS, pcFreeHeap} ptr           <*> #{peek GC_FLAGS, generations} ptr-          <*> #{peek GC_FLAGS, squeezeUpdFrames} ptr-          <*> #{peek GC_FLAGS, compact} ptr+          <*> (toBool <$>+                (#{peek GC_FLAGS, squeezeUpdFrames} ptr :: IO CBool))+          <*> (toBool <$>+                (#{peek GC_FLAGS, compact} ptr :: IO CBool))           <*> #{peek GC_FLAGS, compactThreshold} ptr-          <*> #{peek GC_FLAGS, sweep} ptr-          <*> #{peek GC_FLAGS, ringBell} ptr+          <*> (toBool <$>+                (#{peek GC_FLAGS, sweep} ptr :: IO CBool))+          <*> (toBool <$>+                (#{peek GC_FLAGS, ringBell} ptr :: IO CBool))           <*> #{peek GC_FLAGS, idleGCDelayTime} ptr-          <*> #{peek GC_FLAGS, doIdleGC} ptr+          <*> (toBool <$>+                (#{peek GC_FLAGS, doIdleGC} ptr :: IO CBool))           <*> #{peek GC_FLAGS, heapBase} ptr           <*> #{peek GC_FLAGS, allocLimitGrace} ptr-          <*> #{peek GC_FLAGS, numa} ptr+          <*> (toBool <$>+                (#{peek GC_FLAGS, numa} ptr :: IO CBool))           <*> #{peek GC_FLAGS, numaMask} ptr  getParFlags :: IO ParFlags@@ -383,15 +393,19 @@   let ptr = (#ptr RTS_FLAGS, ParFlags) rtsFlagsPtr   ParFlags     <$> #{peek PAR_FLAGS, nCapabilities} ptr-    <*> #{peek PAR_FLAGS, migrate} ptr+    <*> (toBool <$>+          (#{peek PAR_FLAGS, migrate} ptr :: IO CBool))     <*> #{peek PAR_FLAGS, maxLocalSparks} ptr-    <*> #{peek PAR_FLAGS, parGcEnabled} ptr+    <*> (toBool <$>+          (#{peek PAR_FLAGS, parGcEnabled} ptr :: IO CBool))     <*> #{peek PAR_FLAGS, parGcGen} ptr-    <*> #{peek PAR_FLAGS, parGcLoadBalancingEnabled} ptr+    <*> (toBool <$>+          (#{peek PAR_FLAGS, parGcLoadBalancingEnabled} ptr :: IO CBool))     <*> #{peek PAR_FLAGS, parGcLoadBalancingGen} ptr     <*> #{peek PAR_FLAGS, parGcNoSyncWithIdle} ptr     <*> #{peek PAR_FLAGS, parGcThreads} ptr-    <*> #{peek PAR_FLAGS, setAffinity} ptr+    <*> (toBool <$>+          (#{peek PAR_FLAGS, setAffinity} ptr :: IO CBool))  getConcFlags :: IO ConcFlags getConcFlags = do@@ -403,28 +417,51 @@ getMiscFlags = do   let ptr = (#ptr RTS_FLAGS, MiscFlags) rtsFlagsPtr   MiscFlags <$> #{peek MISC_FLAGS, tickInterval} ptr-            <*> #{peek MISC_FLAGS, install_signal_handlers} ptr-            <*> #{peek MISC_FLAGS, machineReadable} ptr+            <*> (toBool <$>+                  (#{peek MISC_FLAGS, install_signal_handlers} ptr :: IO CBool))+            <*> (toBool <$>+                  (#{peek MISC_FLAGS, install_seh_handlers} ptr :: IO CBool))+            <*> (toBool <$>+                  (#{peek MISC_FLAGS, generate_dump_file} ptr :: IO CBool))+            <*> (toBool <$>+                  (#{peek MISC_FLAGS, generate_stack_trace} ptr :: IO CBool))+            <*> (toBool <$>+                  (#{peek MISC_FLAGS, machineReadable} ptr :: IO CBool))             <*> #{peek MISC_FLAGS, linkerMemBase} ptr  getDebugFlags :: IO DebugFlags getDebugFlags = do   let ptr = (#ptr RTS_FLAGS, DebugFlags) rtsFlagsPtr-  DebugFlags <$> #{peek DEBUG_FLAGS, scheduler} ptr-             <*> #{peek DEBUG_FLAGS, interpreter} ptr-             <*> #{peek DEBUG_FLAGS, weak} ptr-             <*> #{peek DEBUG_FLAGS, gccafs} ptr-             <*> #{peek DEBUG_FLAGS, gc} ptr-             <*> #{peek DEBUG_FLAGS, block_alloc} ptr-             <*> #{peek DEBUG_FLAGS, sanity} ptr-             <*> #{peek DEBUG_FLAGS, stable} ptr-             <*> #{peek DEBUG_FLAGS, prof} ptr-             <*> #{peek DEBUG_FLAGS, linker} ptr-             <*> #{peek DEBUG_FLAGS, apply} ptr-             <*> #{peek DEBUG_FLAGS, stm} ptr-             <*> #{peek DEBUG_FLAGS, squeeze} ptr-             <*> #{peek DEBUG_FLAGS, hpc} ptr-             <*> #{peek DEBUG_FLAGS, sparks} ptr+  DebugFlags <$> (toBool <$>+                   (#{peek DEBUG_FLAGS, scheduler} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, interpreter} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, weak} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, gccafs} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, gc} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, block_alloc} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, sanity} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, stable} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, prof} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, linker} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, apply} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, stm} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, squeeze} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, hpc} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek DEBUG_FLAGS, sparks} ptr :: IO CBool))  getCCFlags :: IO CCFlags getCCFlags = do@@ -440,8 +477,10 @@   ProfFlags <$> (toEnum <$> #{peek PROFILING_FLAGS, doHeapProfile} ptr)             <*> #{peek PROFILING_FLAGS, heapProfileInterval} ptr             <*> #{peek PROFILING_FLAGS, heapProfileIntervalTicks} ptr-            <*> #{peek PROFILING_FLAGS, includeTSOs} ptr-            <*> #{peek PROFILING_FLAGS, showCCSOnException} ptr+            <*> (toBool <$>+                  (#{peek PROFILING_FLAGS, includeTSOs} ptr :: IO CBool))+            <*> (toBool <$>+                  (#{peek PROFILING_FLAGS, showCCSOnException} ptr :: IO CBool))             <*> #{peek PROFILING_FLAGS, maxRetainerSetSize} ptr             <*> #{peek PROFILING_FLAGS, ccsLength} ptr             <*> (peekCStringOpt =<< #{peek PROFILING_FLAGS, modSelector} ptr)@@ -457,15 +496,22 @@   let ptr = (#ptr RTS_FLAGS, TraceFlags) rtsFlagsPtr   TraceFlags <$> (toEnum . fromIntegral                    <$> (#{peek TRACE_FLAGS, tracing} ptr :: IO CInt))-             <*> #{peek TRACE_FLAGS, timestamp} ptr-             <*> #{peek TRACE_FLAGS, scheduler} ptr-             <*> #{peek TRACE_FLAGS, gc} ptr-             <*> #{peek TRACE_FLAGS, sparks_sampled} ptr-             <*> #{peek TRACE_FLAGS, sparks_full} ptr-             <*> #{peek TRACE_FLAGS, user} ptr+             <*> (toBool <$>+                   (#{peek TRACE_FLAGS, timestamp} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek TRACE_FLAGS, scheduler} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek TRACE_FLAGS, gc} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek TRACE_FLAGS, sparks_sampled} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek TRACE_FLAGS, sparks_full} ptr :: IO CBool))+             <*> (toBool <$>+                   (#{peek TRACE_FLAGS, user} ptr :: IO CBool))  getTickyFlags :: IO TickyFlags getTickyFlags = do   let ptr = (#ptr RTS_FLAGS, TickyFlags) rtsFlagsPtr-  TickyFlags <$> #{peek TICKY_FLAGS, showTickyStats} ptr+  TickyFlags <$> (toBool <$>+                   (#{peek TICKY_FLAGS, showTickyStats} ptr :: IO CBool))              <*> (peekFilePath =<< #{peek TICKY_FLAGS, tickyFile} ptr)
GHC/Read.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE Trustworthy #-}-{-# LANGUAGE NoImplicitPrelude, StandaloneDeriving, ScopedTypeVariables #-}+{-# LANGUAGE CPP, NoImplicitPrelude, StandaloneDeriving, ScopedTypeVariables #-} {-# OPTIONS_HADDOCK hide #-}  -----------------------------------------------------------------------------@@ -36,12 +36,16 @@   , choose   , readListDefault, readListPrecDefault   , readNumber+  , readField+  , readSymField    -- Temporary   , readParen   )  where +#include "MachDeps.h"+ import qualified Text.ParserCombinators.ReadP as P  import Text.ParserCombinators.ReadP@@ -66,6 +70,7 @@ import GHC.Show import GHC.Base import GHC.Arr+import GHC.Word   -- | @'readParen' 'True' p@ parses what @p@ parses, but surrounded with@@ -356,6 +361,50 @@                                     L.Symbol s' | s==s' -> p                                     _other              -> pfail } +-- See Note [Why readField]++-- | 'Read' parser for a record field, of the form @fieldName=value@. The+-- @fieldName@ must be an alphanumeric identifier; for symbols (operator-style)+-- field names, e.g. @(#)@, use 'readSymField'). The second argument is a+-- parser for the field value.+readField :: String -> ReadPrec a -> ReadPrec a+readField fieldName readVal = do+        expectP (L.Ident fieldName)+        expectP (L.Punc "=")+        readVal+{-# NOINLINE readField #-}++-- See Note [Why readField]++-- | 'Read' parser for a symbol record field, of the form @(###)=value@ (where+-- @###@ is the field name). The field name must be a symbol (operator-style),+-- e.g. @(#)@. For regular (alphanumeric) field names, use 'readField'. The+-- second argument is a parser for the field value.+readSymField :: String -> ReadPrec a -> ReadPrec a+readSymField fieldName readVal = do+        expectP (L.Punc "(")+        expectP (L.Symbol fieldName)+        expectP (L.Punc ")")+        expectP (L.Punc "=")+        readVal+{-# NOINLINE readSymField #-}+++-- Note [Why readField]+--+-- Previousy, the code for automatically deriving Read instance (in+-- typecheck/TcGenDeriv.hs) would generate inline code for parsing fields;+-- this, however, turned out to produce massive amounts of intermediate code,+-- and produced a considerable performance hit in the code generator.+-- Since Read instances are not generally supposed to be perfomance critical,+-- the readField and readSymField functions have been factored out, and the+-- code generator now just generates calls rather than manually inlining the+-- parsers. For large record types (e.g. 500 fields), this produces a+-- significant performance boost.+--+-- See also Trac #14364.++ -------------------------------------------------------------- -- Simple instances of Read --------------------------------------------------------------@@ -409,6 +458,8 @@   readListPrec = readListPrecDefault   readList     = readListDefault +deriving instance Read a => Read (NonEmpty a)+ -------------------------------------------------------------- -- Structure instances of Read: Maybe, List etc --------------------------------------------------------------@@ -518,6 +569,26 @@  -- | @since 4.5.0.0 instance Read Word where+    readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]++-- | @since 2.01+instance Read Word8 where+    readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]++-- | @since 2.01+instance Read Word16 where+    readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]++-- | @since 2.01+instance Read Word32 where+#if WORD_SIZE_IN_BITS < 33+    readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]+#else+    readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]+#endif++-- | @since 2.01+instance Read Word64 where     readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]  -- | @since 2.01
GHC/Real.hs view
@@ -27,7 +27,7 @@ import GHC.Show import {-# SOURCE #-} GHC.Exception( divZeroException, overflowException, ratioZeroDenomException ) -#ifdef OPTIMISE_INTEGER_GCD_LCM+#if defined(OPTIMISE_INTEGER_GCD_LCM) # if defined(MIN_VERSION_integer_gmp) import GHC.Integer.GMP.Internals # else@@ -493,17 +493,23 @@     where -- f : x0 ^ y0 = x ^ y           f x y | even y    = f (x * x) (y `quot` 2)                 | y == 1    = x-                | otherwise = g (x * x) ((y - 1) `quot` 2) x+                | otherwise = g (x * x) (y `quot` 2) x         -- See Note [Half of y - 1]           -- g : x0 ^ y0 = (x ^ y) * z           g x y z | even y = g (x * x) (y `quot` 2) z                   | y == 1 = x * z-                  | otherwise = g (x * x) ((y - 1) `quot` 2) (x * z)+                  | otherwise = g (x * x) (y `quot` 2) (x * z) -- See Note [Half of y - 1]  -- | raise a number to an integral power (^^)            :: (Fractional a, Integral b) => a -> b -> a {-# INLINABLE [1] (^^) #-}         -- See Note [Inlining (^) x ^^ n          =  if n >= 0 then x^n else recip (x^(negate n)) +{- Note [Half of y - 1]+   ~~~~~~~~~~~~~~~~~~~~~+   Since y is guaranteed to be odd and positive here,+   half of y - 1 can be computed as y `quot` 2, optimising subtraction away.+-}+ {- Note [Inlining (^)    ~~~~~~~~~~~~~~~~~~~~~    The INLINABLE pragma allows (^) to be specialised at its call sites.@@ -527,9 +533,7 @@     be statically resolved to 0 or 1 are rare.      It might be desirable to have corresponding rules also for-    exponents of other types, in particular Word, but we can't-    have those rules here (importing GHC.Word or GHC.Int would-    create a cyclic module dependency), and it's doubtful they+    exponents of other types (e. g., Word), but it's doubtful they     would fire, since the exponents of other types tend to get     floated out before the rule has a chance to fire. @@ -631,12 +635,13 @@ -- | @'lcm' x y@ is the smallest positive integer that both @x@ and @y@ divide. lcm             :: (Integral a) => a -> a -> a {-# SPECIALISE lcm :: Int -> Int -> Int #-}+{-# SPECIALISE lcm :: Word -> Word -> Word #-} {-# NOINLINE [1] lcm #-} lcm _ 0         =  0 lcm 0 _         =  0 lcm x y         =  abs ((x `quot` (gcd x y)) * y) -#ifdef OPTIMISE_INTEGER_GCD_LCM+#if defined(OPTIMISE_INTEGER_GCD_LCM) {-# RULES "gcd/Int->Int->Int"             gcd = gcdInt' "gcd/Integer->Integer->Integer" gcd = gcdInteger@@ -646,14 +651,12 @@ gcdInt' :: Int -> Int -> Int gcdInt' (I# x) (I# y) = I# (gcdInt x y) -#if MIN_VERSION_integer_gmp(1,0,0) {-# RULES "gcd/Word->Word->Word"          gcd = gcdWord'  #-}  gcdWord' :: Word -> Word -> Word gcdWord' (W# x) (W# y) = W# (gcdWord x y)-#endif #endif  integralEnumFrom :: (Integral a, Bounded a) => a -> [a]
+ GHC/Real.hs-boot view
@@ -0,0 +1,7 @@+{-# LANGUAGE NoImplicitPrelude #-}++module GHC.Real where++import GHC.Types ()++class Integral a
GHC/ST.hs view
@@ -26,6 +26,7 @@  import GHC.Base import GHC.Show+import qualified Control.Monad.Fail as Fail  default () @@ -76,6 +77,18 @@         case (m s) of { (# new_s, r #) ->         case (k r) of { ST k2 ->         (k2 new_s) }})++-- | @since 4.11.0.0+instance Fail.MonadFail (ST s) where+    fail s = errorWithoutStackTrace s++-- | @since 4.11.0.0+instance Semigroup a => Semigroup (ST s a) where+    (<>) = liftA2 (<>)++-- | @since 4.11.0.0+instance Monoid a => Monoid (ST s a) where+    mempty = pure mempty  data STret s a = STret (State# s) a 
GHC/STRef.hs view
@@ -24,9 +24,21 @@ import GHC.ST import GHC.Base +-- $setup+-- import Prelude+ data STRef s a = STRef (MutVar# s a) -- ^ a value of type @STRef s a@ is a mutable variable in state thread @s@, -- containing a value of type @a@+--+-- >>> :{+-- runST (do+--     ref <- newSTRef "hello"+--     x <- readSTRef ref+--     writeSTRef ref (x ++ "world")+--     readSTRef ref )+-- :}+-- "helloworld"  -- |Build a new 'STRef' in the current state thread newSTRef :: a -> ST s (STRef s a)@@ -44,7 +56,8 @@     case writeMutVar# var# val s1#      of { s2# ->     (# s2#, () #) } --- Just pointer equality on mutable references:--- | @since 2.01+-- | Pointer equality.+--+-- @since 2.01 instance Eq (STRef s a) where     STRef v1# == STRef v2# = isTrue# (sameMutVar# v1# v2#)
GHC/Show.hs view
@@ -53,7 +53,9 @@ import GHC.List ((!!), foldr1, break) import GHC.Num import GHC.Stack.Types+import GHC.Types (TypeLitSort (..)) + -- | The @shows@ functions return a function that prepends the -- output 'String' to an existing 'String'.  This allows constant-time -- concatenation of results using function composition.@@ -198,6 +200,7 @@                    showWord (w# `quotWord#` 10##) (C# c# : cs)  deriving instance Show a => Show (Maybe a)+deriving instance Show a => Show (NonEmpty a)  -- | @since 2.01 instance Show TyCon where@@ -468,7 +471,7 @@         | otherwise = integerToString n r     showList = showList__ (showsPrec 0) --- Divide an conquer implementation of string conversion+-- Divide and conquer implementation of string conversion integerToString :: Integer -> String -> String integerToString n0 cs0     | n0 < 0    = '-' : integerToString' (- n0) cs0@@ -546,3 +549,39 @@              c@(C# _) -> jblock' (d - 1) q (c : cs)         where         (q, r) = n `quotRemInt` 10++instance Show KindRep where+  showsPrec d (KindRepVar v) = showParen (d > 10) $+    showString "KindRepVar " . showsPrec 11 v+  showsPrec d (KindRepTyConApp p q) = showParen (d > 10) $+    showString "KindRepTyConApp "+      . showsPrec 11 p+      . showString " "+      . showsPrec 11 q+  showsPrec d (KindRepApp p q) = showParen (d > 10) $+    showString "KindRepApp "+      . showsPrec 11 p+      . showString " "+      . showsPrec 11 q+  showsPrec d (KindRepFun p q) = showParen (d > 10) $+    showString "KindRepFun "+      . showsPrec 11 p+      . showString " "+      . showsPrec 11 q+  showsPrec d (KindRepTYPE rep) = showParen (d > 10) $+    showString "KindRepTYPE " . showsPrec 11 rep+  showsPrec d (KindRepTypeLitS p q) = showParen (d > 10) $+    showString "KindRepTypeLitS "+      . showsPrec 11 p+      . showString " "+      . showsPrec 11 (unpackCString# q)+  showsPrec d (KindRepTypeLitD p q) = showParen (d > 10) $+    showString "KindRepTypeLitD "+      . showsPrec 11 p+      . showString " "+      . showsPrec 11 q++deriving instance Show RuntimeRep+deriving instance Show VecCount+deriving instance Show VecElem+deriving instance Show TypeLitSort
GHC/Stack.hs view
@@ -85,7 +85,10 @@ -- -- @since 4.9.0.0 callStack :: HasCallStack => CallStack-callStack = popCallStack ?callStack+callStack =+  case ?callStack of+    EmptyCallStack -> EmptyCallStack+    _              -> popCallStack ?callStack {-# INLINE callStack #-}  -- | Perform some computation without adding new entries to the 'CallStack'.
GHC/Stack/CCS.hsc view
@@ -48,34 +48,50 @@ #define PROFILING #include "Rts.h" +-- | A cost-centre stack from GHC's cost-center profiler. data CostCentreStack++-- | A cost-centre from GHC's cost-center profiler. data CostCentre +-- | Returns the current 'CostCentreStack' (value is @nullPtr@ if the current+-- program was not compiled with profiling support). Takes a dummy argument+-- which can be used to avoid the call to @getCurrentCCS@ being floated out by+-- the simplifier, which would result in an uninformative stack ("CAF"). getCurrentCCS :: dummy -> IO (Ptr CostCentreStack) getCurrentCCS dummy = IO $ \s ->    case getCurrentCCS## dummy s of      (## s', addr ##) -> (## s', Ptr addr ##) +-- | Get the 'CostCentreStack' associated with the given value. getCCSOf :: a -> IO (Ptr CostCentreStack) getCCSOf obj = IO $ \s ->    case getCCSOf## obj s of      (## s', addr ##) -> (## s', Ptr addr ##) +-- | Run a computation with an empty cost-center stack. For example, this is+-- used by the interpreter to run an interpreted computation without the call+-- stack showing that it was invoked from GHC. clearCCS :: IO a -> IO a clearCCS (IO m) = IO $ \s -> clearCCS## m s +-- | Get the 'CostCentre' at the head of a 'CostCentreStack'. ccsCC :: Ptr CostCentreStack -> IO (Ptr CostCentre) ccsCC p = (# peek CostCentreStack, cc) p +-- | Get the tail of a 'CostCentreStack'. ccsParent :: Ptr CostCentreStack -> IO (Ptr CostCentreStack) ccsParent p = (# peek CostCentreStack, prevStack) p +-- | Get the label of a 'CostCentre'. ccLabel :: Ptr CostCentre -> IO CString ccLabel p = (# peek CostCentre, label) p +-- | Get the module of a 'CostCentre'. ccModule :: Ptr CostCentre -> IO CString ccModule p = (# peek CostCentre, module) p +-- | Get the source span of a 'CostCentre'. ccSrcSpan :: Ptr CostCentre -> IO CString ccSrcSpan p = (# peek CostCentre, srcloc) p @@ -92,6 +108,7 @@ currentCallStack :: IO [String] currentCallStack = ccsToStrings =<< getCurrentCCS () +-- | Format a 'CostCentreStack' as a list of lines. ccsToStrings :: Ptr CostCentreStack -> IO [String] ccsToStrings ccs0 = go ccs0 []   where
GHC/Stack/Types.hs view
@@ -41,12 +41,10 @@ import cycle,      Module imports form a cycle:-           module ‘Data.Maybe’ (libraries/base/Data/Maybe.hs)-          imports ‘GHC.Base’ (libraries/base/GHC/Base.hs)-    which imports ‘GHC.Err’ (libraries/base/GHC/Err.hs)+           module ‘GHC.Base’ (libraries/base/GHC/Base.hs)+          imports ‘GHC.Err’ (libraries/base/GHC/Err.hs)     which imports ‘GHC.Stack’ (libraries/base/dist-install/build/GHC/Stack.hs)-    which imports ‘GHC.Foreign’ (libraries/base/GHC/Foreign.hs)-    which imports ‘Data.Maybe’ (libraries/base/Data/Maybe.hs)+    which imports ‘GHC.Base‘ (libraries/base/GHC/Base.hs) -}  import GHC.Classes (Eq)@@ -77,25 +75,28 @@ -- For example, we can define -- -- @--- errorWithCallStack :: HasCallStack => String -> a+-- putStrLnWithCallStack :: HasCallStack => String -> IO () -- @ ----- as a variant of @error@ that will get its call-site. We can access the--- call-stack inside @errorWithCallStack@ with 'GHC.Stack.callStack'.+-- as a variant of @putStrLn@ that will get its call-site and print it,+-- along with the string given as argument. We can access the+-- call-stack inside @putStrLnWithCallStack@ with 'GHC.Stack.callStack'. -- -- @--- errorWithCallStack :: HasCallStack => String -> a--- errorWithCallStack msg = error (msg ++ "\n" ++ prettyCallStack callStack)+-- putStrLnWithCallStack :: HasCallStack => String -> IO ()+-- putStrLnWithCallStack msg = do+--   putStrLn msg+--   putStrLn (prettyCallStack callStack) -- @ ----- Thus, if we call @errorWithCallStack@ we will get a formatted call-stack--- alongside our error message.+-- Thus, if we call @putStrLnWithCallStack@ we will get a formatted call-stack+-- alongside our string. -- ----- >>> errorWithCallStack "die"--- *** Exception: die+-- >>> putStrLnWithCallStack "hello"+-- hello -- CallStack (from HasCallStack):---   errorWithCallStack, called at <interactive>:2:1 in interactive:Ghci1+--   putStrLnWithCallStack, called at <interactive>:2:1 in interactive:Ghci1 -- -- -- GHC solves 'HasCallStack' constraints in three steps:
GHC/StaticPtr.hs view
@@ -28,6 +28,11 @@ -- table is known as the Static Pointer Table. The reference can then be -- dereferenced to obtain the value. --+-- The various communicating processes need to aggree on the keys used to refer+-- to the values in the Static Pointer Table, or lookups will fail. Only+-- processes launched from the same program binary are guaranteed to use the+-- same set of keys.+-- -----------------------------------------------------------------------------  module GHC.StaticPtr
GHC/Stats.hsc view
@@ -18,20 +18,12 @@       RTSStats(..), GCDetails(..), RtsTime     , getRTSStats     , getRTSStatsEnabled--    -- * DEPRECATED, don't use-    , GCStats(..)-    , getGCStats-    , getGCStatsEnabled ) where -import Control.Applicative import Control.Monad import Data.Int import Data.Word import GHC.Base-import GHC.Num (Num(..))-import GHC.Real (quot, fromIntegral, (/)) import GHC.Read ( Read ) import GHC.Show ( Show ) import GHC.IO.Exception@@ -45,14 +37,14 @@  -- | Returns whether GC stats have been enabled (with @+RTS -T@, for example). ----- @since 4.9.0.0+-- @since 4.10.0.0 foreign import ccall "getRTSStatsEnabled" getRTSStatsEnabled :: IO Bool  -- -- | Statistics about runtime activity since the start of the -- program.  This is a mirror of the C @struct RTSStats@ in @RtsAPI.h@ ----- @since 4.9.0.0+-- @since 4.10.0.0 -- data RTSStats = RTSStats {   -- -----------------------------------@@ -81,8 +73,10 @@   , copied_bytes :: Word64     -- | Sum of copied_bytes across all parallel GCs   , par_copied_bytes :: Word64-    -- | Sum of par_max_copied_bytes across all parallel GCs+    -- | Sum of par_max_copied_bytes across all parallel GCs. Deprecated.   , cumulative_par_max_copied_bytes :: Word64+    -- | Sum of par_balanced_copied bytes across all parallel GCs+  , cumulative_par_balanced_copied_bytes :: Word64    -- -----------------------------------   -- Cumulative stats about time use@@ -130,8 +124,11 @@   , gcdetails_mem_in_use_bytes :: Word64     -- | Total amount of data copied during this GC   , gcdetails_copied_bytes :: Word64-    -- | In parallel GC, the max amount of data copied by any one thread+    -- | In parallel GC, the max amount of data copied by any one thread.+    -- Deprecated.   , gcdetails_par_max_copied_bytes :: Word64+    -- | In parallel GC, the amount of balanced data copied by all threads+  , gcdetails_par_balanced_copied_bytes :: Word64     -- | The time elapsed during synchronisation before GC   , gcdetails_sync_elapsed_ns :: RtsTime     -- | The CPU time used during GC itself@@ -143,16 +140,18 @@ -- | Time values from the RTS, using a fixed resolution of nanoseconds. type RtsTime = Int64 --- @since 4.9.0.0+-- | Get current runtime system statistics. --+-- @since 4.10.0.0+-- getRTSStats :: IO RTSStats getRTSStats = do-  statsEnabled <- getGCStatsEnabled+  statsEnabled <- getRTSStatsEnabled   unless statsEnabled .  ioError $ IOError     Nothing     UnsupportedOperation     ""-    "getGCStats: GC stats not enabled. Use `+RTS -T -RTS' to enable them."+    "GHC.Stats.getRTSStats: GC stats not enabled. Use `+RTS -T -RTS' to enable them."     Nothing     Nothing   allocaBytes (#size RTSStats) $ \p -> do@@ -170,6 +169,8 @@     par_copied_bytes <- (# peek RTSStats, par_copied_bytes) p     cumulative_par_max_copied_bytes <-       (# peek RTSStats, cumulative_par_max_copied_bytes) p+    cumulative_par_balanced_copied_bytes <-+      (# peek RTSStats, cumulative_par_balanced_copied_bytes) p     mutator_cpu_ns <- (# peek RTSStats, mutator_cpu_ns) p     mutator_elapsed_ns <- (# peek RTSStats, mutator_elapsed_ns) p     gc_cpu_ns <- (# peek RTSStats, gc_cpu_ns) p@@ -190,128 +191,10 @@       gcdetails_copied_bytes <- (# peek GCDetails, copied_bytes) pgc       gcdetails_par_max_copied_bytes <-         (# peek GCDetails, par_max_copied_bytes) pgc+      gcdetails_par_balanced_copied_bytes <-+        (# peek GCDetails, par_balanced_copied_bytes) pgc       gcdetails_sync_elapsed_ns <- (# peek GCDetails, sync_elapsed_ns) pgc       gcdetails_cpu_ns <- (# peek GCDetails, cpu_ns) pgc       gcdetails_elapsed_ns <- (# peek GCDetails, elapsed_ns) pgc       return GCDetails{..}     return RTSStats{..}---- -------------------------------------------------------------------------------- DEPRECATED API---- I'm probably violating a bucket of constraints here... oops.---- | Statistics about memory usage and the garbage collector. Apart from--- 'currentBytesUsed' and 'currentBytesSlop' all are cumulative values since--- the program started.------ @since 4.5.0.0-{-# DEPRECATED GCStats "Use RTSStats instead.  This will be removed in GHC 8.4.1" #-}-data GCStats = GCStats-    { -- | Total number of bytes allocated-    bytesAllocated :: !Int64-    -- | Number of garbage collections performed (any generation, major and-    -- minor)-    , numGcs :: !Int64-    -- | Maximum number of live bytes seen so far-    , maxBytesUsed :: !Int64-    -- | Number of byte usage samples taken, or equivalently-    -- the number of major GCs performed.-    , numByteUsageSamples :: !Int64-    -- | Sum of all byte usage samples, can be used with-    -- 'numByteUsageSamples' to calculate averages with-    -- arbitrary weighting (if you are sampling this record multiple-    -- times).-    , cumulativeBytesUsed :: !Int64-    -- | Number of bytes copied during GC-    , bytesCopied :: !Int64-    -- | Number of live bytes at the end of the last major GC-    , currentBytesUsed :: !Int64-    -- | Current number of bytes lost to slop-    , currentBytesSlop :: !Int64-    -- | Maximum number of bytes lost to slop at any one time so far-    , maxBytesSlop :: !Int64-    -- | Maximum number of megabytes allocated-    , peakMegabytesAllocated :: !Int64-    -- | CPU time spent running mutator threads.  This does not include-    -- any profiling overhead or initialization.-    , mblocksAllocated :: !Int64 -- ^ Number of allocated megablocks-    , mutatorCpuSeconds :: !Double--    -- | Wall clock time spent running mutator threads.  This does not-    -- include initialization.-    , mutatorWallSeconds :: !Double-    -- | CPU time spent running GC-    , gcCpuSeconds :: !Double-    -- | Wall clock time spent running GC-    , gcWallSeconds :: !Double-    -- | Total CPU time elapsed since program start-    , cpuSeconds :: !Double-    -- | Total wall clock time elapsed since start-    , wallSeconds :: !Double-    -- | Number of bytes copied during GC, minus space held by mutable-    -- lists held by the capabilities.  Can be used with-    -- 'parMaxBytesCopied' to determine how well parallel GC utilized-    -- all cores.-    , parTotBytesCopied :: !Int64--    -- | Sum of number of bytes copied each GC by the most active GC-    -- thread each GC.  The ratio of 'parTotBytesCopied' divided by-    -- 'parMaxBytesCopied' approaches 1 for a maximally sequential-    -- run and approaches the number of threads (set by the RTS flag-    -- @-N@) for a maximally parallel run.-    , parMaxBytesCopied :: !Int64-    } deriving (Show, Read)---- | Retrieves garbage collection and memory statistics as of the last--- garbage collection.  If you would like your statistics as recent as--- possible, first run a 'System.Mem.performGC'.------ @since 4.5.0.0-{-# DEPRECATED getGCStats-    "Use getRTSStats instead.  This will be removed in GHC 8.4.1" #-}-getGCStats :: IO GCStats-getGCStats = do-  statsEnabled <- getGCStatsEnabled-  unless statsEnabled .  ioError $ IOError-    Nothing-    UnsupportedOperation-    ""-    "getGCStats: GC stats not enabled. Use `+RTS -T -RTS' to enable them."-    Nothing-    Nothing-  allocaBytes (#size RTSStats) $ \p -> do-    getRTSStats_ p-    bytesAllocated <- (# peek RTSStats, allocated_bytes) p-    numGcs <- (# peek RTSStats, gcs ) p-    numByteUsageSamples <- (# peek RTSStats, major_gcs ) p-    maxBytesUsed <- (# peek RTSStats, max_live_bytes ) p-    cumulativeBytesUsed <- (# peek RTSStats, cumulative_live_bytes ) p-    bytesCopied <- (# peek RTSStats, copied_bytes ) p-    currentBytesUsed <- (# peek RTSStats, gc.live_bytes ) p-    currentBytesSlop <- (# peek RTSStats, gc.slop_bytes) p-    maxBytesSlop <- (# peek RTSStats, max_slop_bytes) p-    peakMegabytesAllocated <- do-      bytes <- (# peek RTSStats, max_mem_in_use_bytes ) p-      return (bytes `quot` (1024*1024))-    mblocksAllocated <- do-      bytes <- (# peek RTSStats, gc.mem_in_use_bytes) p-      return (bytes `quot` (1024*1024))-    mutatorCpuSeconds <- nsToSecs <$> (# peek RTSStats, mutator_cpu_ns) p-    mutatorWallSeconds <--      nsToSecs <$> (# peek RTSStats, mutator_elapsed_ns) p-    gcCpuSeconds <- nsToSecs <$> (# peek RTSStats, gc_cpu_ns) p-    gcWallSeconds <- nsToSecs <$> (# peek RTSStats, gc_elapsed_ns) p-    cpuSeconds <- nsToSecs <$> (# peek RTSStats, cpu_ns) p-    wallSeconds <- nsToSecs <$> (# peek RTSStats, elapsed_ns) p-    parTotBytesCopied <- (# peek RTSStats, par_copied_bytes) p-    parMaxBytesCopied <- (# peek RTSStats, cumulative_par_max_copied_bytes) p-    return GCStats { .. }--nsToSecs :: Int64 -> Double-nsToSecs ns = fromIntegral ns / (# const TIME_RESOLUTION)--{-# DEPRECATED getGCStatsEnabled-    "use getRTSStatsEnabled instead.  This will be removed in GHC 8.4.1" #-}-getGCStatsEnabled :: IO Bool-getGCStatsEnabled = getRTSStatsEnabled
GHC/TopHandler.hs view
@@ -94,7 +94,7 @@       topHandler  install_interrupt_handler :: IO () -> IO ()-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) install_interrupt_handler handler = do   _ <- GHC.ConsoleHandler.installHandler $      Catch $ \event ->@@ -208,7 +208,7 @@       errorBelch fmt msg >> exit 1   where     msgStr =-        "encountered an exception while trying to report an exception." +++        "encountered an exception while trying to report an exception.\n" ++         "One possible reason for this is that we failed while trying to " ++         "encode an error message. Check that your locale is configured " ++         "properly."@@ -244,7 +244,7 @@ unreachable = fail "If you can read this, shutdownHaskellAndExit did not exit."  exitHelper :: CInt -> Int -> IO a-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) exitHelper exitKind r =   shutdownHaskellAndExit (fromIntegral r) exitKind >> unreachable #else@@ -266,7 +266,7 @@  exitInterrupted :: IO a exitInterrupted =-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   safeExit 252 #else   -- we must exit via the default action for SIGINT, so that the
GHC/TypeLits.hs view
@@ -9,7 +9,6 @@ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE RankNTypes #-}-{-# LANGUAGE UndecidableInstances #-}  -- for compiling instances of (==) {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE PolyKinds #-}@@ -35,6 +34,7 @@      -- * Functions on type literals   , type (N.<=), type (N.<=?), type (N.+), type (N.*), type (N.^), type (N.-)+  , type N.Div, type N.Mod, type N.Log2   , AppendSymbol   , N.CmpNat, CmpSymbol @@ -44,7 +44,7 @@    ) where -import GHC.Base(Eq(..), Ord(..), Bool(True,False), Ordering(..), otherwise)+import GHC.Base(Eq(..), Ord(..), Ordering(..), otherwise) import GHC.Types( Nat, Symbol ) import GHC.Num(Integer, fromInteger) import GHC.Base(String)@@ -54,7 +54,7 @@ import GHC.Prim(magicDict, Proxy#) import Data.Maybe(Maybe(..)) import Data.Proxy (Proxy(..))-import Data.Type.Equality(type (==), (:~:)(Refl))+import Data.Type.Equality((:~:)(Refl)) import Unsafe.Coerce(unsafeCoerce)  import GHC.TypeNats (KnownNat)@@ -121,11 +121,6 @@ -- | @since 4.7.0.0 instance Read SomeSymbol where   readsPrec p xs = [ (someSymbolVal a, ys) | (a,ys) <- readsPrec p xs ]--type family EqSymbol (a :: Symbol) (b :: Symbol) where-  EqSymbol a a = 'True-  EqSymbol a b = 'False-type instance a == b = EqSymbol a b  -------------------------------------------------------------------------------- 
GHC/TypeNats.hs view
@@ -9,7 +9,6 @@ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE RankNTypes #-}-{-# LANGUAGE UndecidableInstances #-}  -- for compiling instances of (==) {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE PolyKinds #-}@@ -34,10 +33,11 @@     -- * Functions on type literals   , type (<=), type (<=?), type (+), type (*), type (^), type (-)   , CmpNat+  , Div, Mod, Log2    ) where -import GHC.Base(Eq(..), Ord(..), Bool(True,False), Ordering(..), otherwise)+import GHC.Base(Eq(..), Ord(..), Bool(True), Ordering(..), otherwise) import GHC.Types( Nat ) import GHC.Natural(Natural) import GHC.Show(Show(..))@@ -45,7 +45,7 @@ import GHC.Prim(magicDict, Proxy#) import Data.Maybe(Maybe(..)) import Data.Proxy (Proxy(..))-import Data.Type.Equality(type (==), (:~:)(Refl))+import Data.Type.Equality((:~:)(Refl)) import Unsafe.Coerce(unsafeCoerce)  --------------------------------------------------------------------------------@@ -95,19 +95,16 @@   readsPrec p xs = do (a,ys) <- readsPrec p xs                       [(someNatVal a, ys)] -type family EqNat (a :: Nat) (b :: Nat) where-  EqNat a a = 'True-  EqNat a b = 'False-type instance a == b = EqNat a b- --------------------------------------------------------------------------------  infix  4 <=?, <= infixl 6 +, --infixl 7 *+infixl 7 *, `Div`, `Mod` infixr 8 ^  -- | Comparison of type-level naturals, as a constraint.+--+-- @since 4.7.0.0 type x <= y = (x <=? y) ~ 'True  -- | Comparison of type-level naturals, as a function.@@ -122,18 +119,42 @@ type family (m :: Nat) <=? (n :: Nat) :: Bool  -- | Addition of type-level naturals.+--+-- @since 4.7.0.0 type family (m :: Nat) + (n :: Nat) :: Nat  -- | Multiplication of type-level naturals.+--+-- @since 4.7.0.0 type family (m :: Nat) * (n :: Nat) :: Nat  -- | Exponentiation of type-level naturals.+--+-- @since 4.7.0.0 type family (m :: Nat) ^ (n :: Nat) :: Nat  -- | Subtraction of type-level naturals. -- -- @since 4.7.0.0 type family (m :: Nat) - (n :: Nat) :: Nat++-- | Division (round down) of natural numbers.+-- @Div x 0@ is undefined (i.e., it cannot be reduced).+--+-- @since 4.11.0.0+type family Div (m :: Nat) (n :: Nat) :: Nat++-- | Modulus of natural numbers.+-- @Mod x 0@ is undefined (i.e., it cannot be reduced).+--+-- @since 4.11.0.0+type family Mod (m :: Nat) (n :: Nat) :: Nat++-- | Log base 2 (round down) of natural numbers.+-- @Log 0@ is undefined (i.e., it cannot be reduced).+--+-- @since 4.11.0.0+type family Log2 (m :: Nat) :: Nat  -------------------------------------------------------------------------------- 
GHC/Word.hs view
@@ -51,7 +51,6 @@ import GHC.Enum import GHC.Num import GHC.Real-import GHC.Read import GHC.Arr import GHC.Show @@ -165,10 +164,6 @@     inRange (m,n) i     = m <= i && i <= n  -- | @since 2.01-instance Read Word8 where-    readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]---- | @since 2.01 instance Bits Word8 where     {-# INLINE shift #-}     {-# INLINE bit #-}@@ -353,10 +348,6 @@     inRange (m,n) i     = m <= i && i <= n  -- | @since 2.01-instance Read Word16 where-    readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]---- | @since 2.01 instance Bits Word16 where     {-# INLINE shift #-}     {-# INLINE bit #-}@@ -657,14 +648,6 @@     unsafeIndex (m,_) i = fromIntegral (i - m)     inRange (m,n) i     = m <= i && i <= n --- | @since 2.01-instance Read Word32 where-#if WORD_SIZE_IN_BITS < 33-    readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]-#else-    readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]-#endif- -- | Reverse order of bytes in 'Word32'. -- -- @since 4.7.0.0@@ -978,10 +961,6 @@     range (m,n)         = [m..n]     unsafeIndex (m,_) i = fromIntegral (i - m)     inRange (m,n) i     = m <= i && i <= n---- | @since 2.01-instance Read Word64 where-    readsPrec p s = [(fromInteger x, r) | (x, r) <- readsPrec p s]  -- | Reverse order of bytes in 'Word64'. --
Numeric.hs view
@@ -33,6 +33,7 @@         showFFloatAlt,         showGFloatAlt,         showFloat,+        showHFloat,          floatToDigits, @@ -69,6 +70,7 @@ import Text.ParserCombinators.ReadP( ReadP, readP_to_S, pfail ) import qualified Text.Read.Lex as L + -- ----------------------------------------------------------------------------- -- Reading @@ -81,15 +83,24 @@ readInt base isDigit valDigit = readP_to_S (L.readIntP base isDigit valDigit)  -- | Read an unsigned number in octal notation.+--+-- >>> readOct "0644"+-- [(420,"")] readOct :: (Eq a, Num a) => ReadS a readOct = readP_to_S L.readOctP  -- | Read an unsigned number in decimal notation.+--+-- >>> readDec "0644"+-- [(644,"")] readDec :: (Eq a, Num a) => ReadS a readDec = readP_to_S L.readDecP  -- | Read an unsigned number in hexadecimal notation. -- Both upper or lower case letters are allowed.+--+-- >>> readHex "deadbeef"+-- [(3735928559,"")] readHex :: (Eq a, Num a) => ReadS a readHex = readP_to_S L.readHexP @@ -203,6 +214,52 @@  showFFloatAlt d x =  showString (formatRealFloatAlt FFFixed d True x) showGFloatAlt d x =  showString (formatRealFloatAlt FFGeneric d True x)++{- | Show a floating-point value in the hexadecimal format,+similar to the @%a@ specifier in C's printf.++  >>> showHFloat (212.21 :: Double) ""+  "0x1.a86b851eb851fp7"+  >>> showHFloat (-12.76 :: Float) ""+  "-0x1.9851ecp3"+  >>> showHFloat (-0 :: Double) ""+  "-0x0p+0"+-}+showHFloat :: RealFloat a => a -> ShowS+showHFloat = showString . fmt+  where+  fmt x+    | isNaN x                   = "NaN"+    | isInfinite x              = (if x < 0 then "-" else "") ++ "Infinity"+    | x < 0 || isNegativeZero x = '-' : cvt (-x)+    | otherwise                 = cvt x++  cvt x+    | x == 0 = "0x0p+0"+    | otherwise =+      case floatToDigits 2 x of+        r@([], _) -> error $ "Impossible happened: showHFloat: " ++ show r+        (d:ds, e) -> "0x" ++ show d ++ frac ds ++ "p" ++ show (e-1)++  -- Given binary digits, convert them to hex in blocks of 4+  -- Special case: If all 0's, just drop it.+  frac digits+    | allZ digits = ""+    | otherwise   = "." ++ hex digits+    where+    hex ds =+      case ds of+        []                -> ""+        [a]               -> hexDigit a 0 0 0 ""+        [a,b]             -> hexDigit a b 0 0 ""+        [a,b,c]           -> hexDigit a b c 0 ""+        a : b : c : d : r -> hexDigit a b c d (hex r)++  hexDigit a b c d = showHex (8*a + 4*b + 2*c + d)++  allZ xs = case xs of+              x : more -> x == 0 && allZ more+              []       -> True  -- --------------------------------------------------------------------------- -- Integer printing functions
Prelude.hs view
@@ -66,7 +66,8 @@     subtract, even, odd, gcd, lcm, (^), (^^),     fromIntegral, realToFrac, -    -- ** Monoids+    -- ** Semigroups and Monoids+    Semigroup((<>)),     Monoid(mempty, mappend, mconcat),      -- ** Monads and functors
System/Environment.hs view
@@ -33,24 +33,24 @@ import Foreign.C import System.IO.Error (mkIOError) import Control.Exception.Base (bracket_, throwIO)-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) import Control.Exception.Base (bracket) #endif -- import GHC.IO import GHC.IO.Exception-import GHC.IO.Encoding (getFileSystemEncoding) import qualified GHC.Foreign as GHC import Control.Monad-#ifdef mingw32_HOST_OS-import GHC.Environment+#if defined(mingw32_HOST_OS)+import GHC.IO.Encoding (argvEncoding) import GHC.Windows #else+import GHC.IO.Encoding (getFileSystemEncoding, argvEncoding) import System.Posix.Internals (withFilePath) #endif  import System.Environment.ExecutablePath -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) # if defined(i386_HOST_ARCH) #  define WINDOWS_CCONV stdcall # elif defined(x86_64_HOST_ARCH)@@ -65,89 +65,21 @@ -- --------------------------------------------------------------------------- -- getArgs, getProgName, getEnv -#ifdef mingw32_HOST_OS--{--Note [Ignore hs_init argv]-~~~~~~~~~~~~~~~~~~~~~~~~~~-Ignore the arguments to hs_init on Windows for the sake of Unicode compat--Instead on Windows we get the list of arguments from getCommandLineW and-filter out arguments which the RTS would not have passed along.--This is done to ensure we get the arguments in proper Unicode Encoding which-the RTS at this moment does not seem provide. The filtering has to match the-one done by the RTS to avoid inconsistencies like #13287.--}--getWin32ProgArgv_certainly :: IO [String]-getWin32ProgArgv_certainly = do-        mb_argv <- getWin32ProgArgv-        case mb_argv of-          -- see Note [Ignore hs_init argv]-          Nothing   -> fmap dropRTSArgs getFullArgs-          Just argv -> return argv--withWin32ProgArgv :: [String] -> IO a -> IO a-withWin32ProgArgv argv act = bracket begin setWin32ProgArgv (\_ -> act)-  where-    begin = do-          mb_old_argv <- getWin32ProgArgv-          setWin32ProgArgv (Just argv)-          return mb_old_argv--getWin32ProgArgv :: IO (Maybe [String])-getWin32ProgArgv = alloca $ \p_argc -> alloca $ \p_argv -> do-        c_getWin32ProgArgv p_argc p_argv-        argc <- peek p_argc-        argv_p <- peek p_argv-        if argv_p == nullPtr-         then return Nothing-         else do-          argv_ps <- peekArray (fromIntegral argc) argv_p-          fmap Just $ mapM peekCWString argv_ps--setWin32ProgArgv :: Maybe [String] -> IO ()-setWin32ProgArgv Nothing = c_setWin32ProgArgv 0 nullPtr-setWin32ProgArgv (Just argv) = withMany withCWString argv $ \argv_ps -> withArrayLen argv_ps $ \argc argv_p -> do-        c_setWin32ProgArgv (fromIntegral argc) argv_p--foreign import ccall unsafe "getWin32ProgArgv"-  c_getWin32ProgArgv :: Ptr CInt -> Ptr (Ptr CWString) -> IO ()--foreign import ccall unsafe "setWin32ProgArgv"-  c_setWin32ProgArgv :: CInt -> Ptr CWString -> IO ()---- See Note [Ignore hs_init argv]-dropRTSArgs :: [String] -> [String]-dropRTSArgs []             = []-dropRTSArgs rest@("--":_)  = rest-dropRTSArgs ("+RTS":rest)  = dropRTSArgs (dropWhile (/= "-RTS") rest)-dropRTSArgs ("--RTS":rest) = rest-dropRTSArgs ("-RTS":rest)  = dropRTSArgs rest-dropRTSArgs (arg:rest)     = arg : dropRTSArgs rest--#endif- -- | Computation 'getArgs' returns a list of the program's command -- line arguments (not including the program name). getArgs :: IO [String]--#ifdef mingw32_HOST_OS-getArgs =  fmap tail getWin32ProgArgv_certainly-#else getArgs =   alloca $ \ p_argc ->   alloca $ \ p_argv -> do    getProgArgv p_argc p_argv    p    <- fromIntegral `liftM` peek p_argc    argv <- peek p_argv-   enc <- getFileSystemEncoding+   enc <- argvEncoding    peekArray (p - 1) (advancePtr argv 1) >>= mapM (GHC.peekCString enc) + foreign import ccall unsafe "getProgArgv"   getProgArgv :: Ptr CInt -> Ptr (Ptr CString) -> IO ()-#endif  {-| Computation 'getProgName' returns the name of the program as it was@@ -160,10 +92,7 @@ is probably really @FOO.EXE@, and that is what 'getProgName' will return. -} getProgName :: IO String-#ifdef mingw32_HOST_OS -- Ignore the arguments to hs_init on Windows for the sake of Unicode compat-getProgName = fmap (basename . head) getWin32ProgArgv_certainly-#else getProgName =   alloca $ \ p_argc ->   alloca $ \ p_argv -> do@@ -173,10 +102,9 @@  unpackProgName  :: Ptr (Ptr CChar) -> IO String   -- argv[0] unpackProgName argv = do-  enc <- getFileSystemEncoding+  enc <- argvEncoding   s <- peekElemOff argv 0 >>= GHC.peekCString enc   return (basename s)-#endif  basename :: FilePath -> FilePath basename f = go f f@@ -188,15 +116,15 @@    isPathSeparator :: Char -> Bool   isPathSeparator '/'  = True-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)   isPathSeparator '\\' = True #endif   isPathSeparator _    = False   -- | Computation 'getEnv' @var@ returns the value--- of the environment variable @var@. For the inverse, POSIX users--- can use 'System.Posix.Env.putEnv'.+-- of the environment variable @var@. For the inverse, the+-- `System.Environment.setEnv` function can be used. -- -- This computation may fail with: --@@ -206,7 +134,7 @@ getEnv :: String -> IO String getEnv name = lookupEnv name >>= maybe handleError return   where-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS)     handleError = do         err <- c_GetLastError         if err == eRROR_ENVVAR_NOT_FOUND@@ -230,7 +158,7 @@ -- -- @since 4.6.0.0 lookupEnv :: String -> IO (Maybe String)-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) lookupEnv name = withCWString name $ \s -> try_size s 256   where     try_size s size = allocaArray (fromIntegral size) $ \p_value -> do@@ -262,9 +190,10 @@  -- | @setEnv name value@ sets the specified environment variable to @value@. ----- On Windows setting an environment variable to the /empty string/ removes+-- Early versions of this function operated under the mistaken belief that+-- setting an environment variable to the /empty string/ on Windows removes -- that environment variable from the environment.  For the sake of--- compatibility we adopt that behavior.  In particular+-- compatibility, it adopted that behavior on POSIX.  In particular -- -- @ -- setEnv name \"\"@@ -276,9 +205,8 @@ -- `unsetEnv` name -- @ ----- If you don't care about Windows support and want to set an environment--- variable to the empty string use @System.Posix.Env.setEnv@ from the @unix@--- package instead.+-- If you'd like to be able to set environment variables to blank strings,+-- use `System.Environment.Blank.setEnv`. -- -- Throws `Control.Exception.IOException` if @name@ is the empty string or -- contains an equals sign.@@ -295,7 +223,7 @@     value = takeWhile (/= '\NUL') value_  setEnv_ :: String -> String -> IO ()-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) setEnv_ key value = withCWString key $ \k -> withCWString value $ \v -> do   success <- c_SetEnvironmentVariable k v   unless success (throwGetLastError "setEnv")@@ -329,7 +257,7 @@ -- -- @since 4.7.0.0 unsetEnv :: String -> IO ()-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) unsetEnv key = withCWString key $ \k -> do   success <- c_SetEnvironmentVariable k nullPtr   unless success $ do@@ -340,7 +268,7 @@       throwGetLastError "unsetEnv" #else -#ifdef HAVE_UNSETENV+#if defined(HAVE_UNSETENV) unsetEnv key = withFilePath key (throwErrnoIf_ (/= 0) "unsetEnv" . c_unsetenv) foreign import ccall unsafe "__hsbase_unsetenv" c_unsetenv :: CString -> IO CInt #else@@ -371,15 +299,7 @@ -- the duration of an action.  withArgv :: [String] -> IO a -> IO a--#ifdef mingw32_HOST_OS--- We have to reflect the updated arguments in the RTS-side variables as--- well, because the RTS still consults them for error messages and the like.--- If we don't do this then ghc-e005 fails.-withArgv new_args act = withWin32ProgArgv new_args $ withProgArgv new_args act-#else withArgv = withProgArgv-#endif  withProgArgv :: [String] -> IO a -> IO a withProgArgv new_args act = do@@ -391,7 +311,7 @@  setProgArgv :: [String] -> IO () setProgArgv argv = do-  enc <- getFileSystemEncoding+  enc <- argvEncoding   GHC.withCStringsLen enc argv $ \len css ->     c_setProgArgv (fromIntegral len) css @@ -406,7 +326,7 @@ -- the @key@ is the whole entry and the @value@ is the empty string. getEnvironment :: IO [(String, String)] -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) getEnvironment = bracket c_GetEnvironmentStrings c_FreeEnvironmentStrings $ \pBlock ->     if pBlock == nullPtr then return []      else go pBlock
+ System/Environment/Blank.hsc view
@@ -0,0 +1,196 @@+{-# LANGUAGE Safe #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE CApiFFI #-}++-----------------------------------------------------------------------------+-- |+-- Module      :  System.Environment.Blank+-- Copyright   :  (c) Habib Alamin 2017+-- License     :  BSD-style (see the file libraries/base/LICENSE)+--+-- Maintainer  :  libraries@haskell.org+-- Stability   :  provisional+-- Portability :  portable+--+-- A setEnv implementation that allows blank environment variables. Mimics+-- the `System.Posix.Env` module from the @unix@ package, but with support+-- for Windows too.+--+-- The matrix of platforms that:+--+--   * support putenv("FOO") to unset environment variables,+--   * support putenv("FOO=") to unset environment variables or set them+--     to blank values,+--   * support unsetenv to unset environment variables,+--   * support setenv to set environment variables,+--   * etc.+--+-- is very complicated. I think AIX is screwed, but we don't support it.+-- The whole situation with setenv(3), unsetenv(3), and putenv(3) is not+-- good. Even mingw32 adds its own crap to the pile, but luckily, we can+-- just use Windows' native environment functions to sidestep the issue.+--+-- #12494+--+-----------------------------------------------------------------------------++module System.Environment.Blank+    (+      module System.Environment,+      getEnv,+      getEnvDefault,+      setEnv,+      unsetEnv,+  ) where++import Foreign.C+#ifdef mingw32_HOST_OS+import Foreign.Ptr+import GHC.Windows+import Control.Monad+#else+import System.Posix.Internals+#endif+import GHC.IO.Exception+import System.IO.Error+import Control.Exception.Base+import Data.Maybe++import System.Environment+    (+      getArgs,+      getProgName,+      getExecutablePath,+      withArgs,+      withProgName,+      getEnvironment+  )+#ifndef mingw32_HOST_OS+import qualified System.Environment as Environment+#endif++-- TODO: include windows_cconv.h when it's merged, instead of duplicating+-- this C macro block.+#if defined(mingw32_HOST_OS)+# if defined(i386_HOST_ARCH)+##  define WINDOWS_CCONV stdcall+# elif defined(x86_64_HOST_ARCH)+##  define WINDOWS_CCONV ccall+# else+##  error Unknown mingw32 arch+# endif+#endif++#include "HsBaseConfig.h"++throwInvalidArgument :: String -> IO a+throwInvalidArgument from =+  throwIO (mkIOError InvalidArgument from Nothing Nothing)++-- | `System.Environment.lookupEnv`.+getEnv :: String -> IO (Maybe String)+#ifdef mingw32_HOST_OS+getEnv = (<$> getEnvironment) . lookup+#else+getEnv = Environment.lookupEnv+#endif++-- | Get an environment value or a default value.+getEnvDefault ::+  String    {- ^ variable name                    -} ->+  String    {- ^ fallback value                   -} ->+  IO String {- ^ variable value or fallback value -}+getEnvDefault name fallback = fromMaybe fallback <$> getEnv name++-- | Like `System.Environment.setEnv`, but allows blank environment values+-- and mimics the function signature of `System.Posix.Env.setEnv` from the+-- @unix@ package.+setEnv ::+  String {- ^ variable name  -} ->+  String {- ^ variable value -} ->+  Bool   {- ^ overwrite      -} ->+  IO ()+setEnv key_ value_ overwrite+  | null key       = throwInvalidArgument "setEnv"+  | '=' `elem` key = throwInvalidArgument "setEnv"+  | otherwise      =+    if overwrite+    then setEnv_ key value+    else do+      env_var <- getEnv key+      case env_var of+          Just _  -> return ()+          Nothing -> setEnv_ key value+  where+    key   = takeWhile (/= '\NUL') key_+    value = takeWhile (/= '\NUL') value_++setEnv_ :: String -> String -> IO ()+#if defined(mingw32_HOST_OS)+setEnv_ key value = withCWString key $ \k -> withCWString value $ \v -> do+  success <- c_SetEnvironmentVariable k v+  unless success (throwGetLastError "setEnv")++foreign import WINDOWS_CCONV unsafe "windows.h SetEnvironmentVariableW"+  c_SetEnvironmentVariable :: LPTSTR -> LPTSTR -> IO Bool+#else+setEnv_ key value =+  withFilePath key $ \ keyP ->+    withFilePath value $ \ valueP ->+      throwErrnoIfMinus1_ "setenv" $+        c_setenv keyP valueP (fromIntegral (fromEnum True))++foreign import ccall unsafe "setenv"+   c_setenv :: CString -> CString -> CInt -> IO CInt+#endif++-- | Like `System.Environment.unsetEnv`, but allows for the removal of+-- blank environment variables.+unsetEnv :: String -> IO ()+#if defined(mingw32_HOST_OS)+unsetEnv key = withCWString key $ \k -> do+  success <- c_SetEnvironmentVariable k nullPtr+  unless success $ do+    -- We consider unsetting an environment variable that does not exist not as+    -- an error, hence we ignore eRROR_ENVVAR_NOT_FOUND.+    err <- c_GetLastError+    unless (err == eRROR_ENVVAR_NOT_FOUND) $ do+      throwGetLastError "unsetEnv"++eRROR_ENVVAR_NOT_FOUND :: DWORD+eRROR_ENVVAR_NOT_FOUND = 203++foreign import WINDOWS_CCONV unsafe "windows.h GetLastError"+  c_GetLastError:: IO DWORD+#elif HAVE_UNSETENV+# if !UNSETENV_RETURNS_VOID+unsetEnv name = withFilePath name $ \ s ->+  throwErrnoIfMinus1_ "unsetenv" (c_unsetenv s)++-- POSIX.1-2001 compliant unsetenv(3)+foreign import capi unsafe "HsBase.h unsetenv"+   c_unsetenv :: CString -> IO CInt+# else+unsetEnv name = withFilePath name c_unsetenv++-- pre-POSIX unsetenv(3) returning @void@+foreign import capi unsafe "HsBase.h unsetenv"+   c_unsetenv :: CString -> IO ()+# endif+#else+unsetEnv name =+  if '=' `elem` name+  then throwInvalidArgument "unsetEnv"+  else putEnv name++putEnv :: String -> IO ()+putEnv keyvalue = do+  s <- getFileSystemEncoding >>= (`newCString` keyvalue)+  -- IMPORTANT: Do not free `s` after calling putenv!+  --+  -- According to SUSv2, the string passed to putenv becomes part of the+  -- environment. #7342+  throwErrnoIf_ (/= 0) "putenv" (c_putenv s)++foreign import ccall unsafe "putenv" c_putenv :: CString -> IO CInt+#endif
System/Environment/ExecutablePath.hsc view
@@ -33,11 +33,13 @@ import Foreign.Marshal.Array import System.Posix.Internals #elif defined(mingw32_HOST_OS)+import Control.Exception+import Data.List import Data.Word import Foreign.C import Foreign.Marshal.Array import Foreign.Ptr-import System.Posix.Internals+#include <windows.h> #else import Foreign.C import Foreign.Marshal.Alloc@@ -54,6 +56,10 @@ -- Note that for scripts and interactive sessions, this is the path to -- the interpreter (e.g. ghci.) --+-- Since base 4.11.0.0, 'getExecutablePath' resolves symlinks on Windows.+-- If an executable is launched through a symlink, 'getExecutablePath'+-- returns the absolute path of the original executable.+-- -- @since 4.6.0.0 getExecutablePath :: IO FilePath @@ -137,17 +143,86 @@ #  error Unknown mingw32 arch # endif -foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"-    c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32- getExecutablePath = go 2048  -- plenty, PATH_MAX is 512 under Win32   where     go size = allocaArray (fromIntegral size) $ \ buf -> do         ret <- c_GetModuleFileName nullPtr buf size         case ret of             0 -> errorWithoutStackTrace "getExecutablePath: GetModuleFileNameW returned an error"-            _ | ret < size -> peekFilePath buf+            _ | ret < size -> do+                  path <- peekCWString buf+                  real <- getFinalPath path+                  exists <- withCWString real c_pathFileExists+                  if exists+                    then return real+                    else fail path               | otherwise  -> go (size * 2)++-- | Returns the final path of the given path. If the given+--   path is a symbolic link, the returned value is the+--   path the (possibly chain of) symbolic link(s) points to.+--   Otherwise, the original path is returned, even when the filepath+--   is incorrect.+--+-- Adapted from:+-- https://msdn.microsoft.com/en-us/library/windows/desktop/aa364962.aspx+getFinalPath :: FilePath -> IO FilePath+getFinalPath path = withCWString path $ \s ->+  bracket (createFile s) c_closeHandle $ \h -> do+    let invalid = h == wordPtrToPtr (#const INVALID_HANDLE_VALUE)+    if invalid then pure path else go h bufSize++  where go h sz = allocaArray (fromIntegral sz) $ \outPath -> do+          ret <- c_getFinalPathHandle h outPath sz (#const FILE_NAME_OPENED)+          if ret < sz+            then sanitize . rejectUNCPath <$> peekCWString outPath+            else go h (2 * sz)++        sanitize s+          | "\\\\?\\" `isPrefixOf` s = drop 4 s+          | otherwise                = s++        -- see https://ghc.haskell.org/trac/ghc/ticket/14460+        rejectUNCPath s+          | "\\\\?\\UNC\\" `isPrefixOf` s = path+          | otherwise                     = s++        -- the initial size of the buffer in which we store the+        -- final path; if this is not enough, we try with a buffer of+        -- size 2^k * bufSize, for k = 1, 2, 3, ... until the buffer+        -- is large enough.+        bufSize = 1024++foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"+    c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32++foreign import WINDOWS_CCONV unsafe "windows.h PathFileExistsW"+    c_pathFileExists :: CWString -> IO Bool++foreign import WINDOWS_CCONV unsafe "windows.h CreateFileW"+    c_createFile :: CWString+                 -> Word32+                 -> Word32+                 -> Ptr ()+                 -> Word32+                 -> Word32+                 -> Ptr ()+                 -> IO (Ptr ())++createFile :: CWString -> IO (Ptr ())+createFile file =+  c_createFile file (#const GENERIC_READ)+                    (#const FILE_SHARE_READ)+                    nullPtr+                    (#const OPEN_EXISTING)+                    (#const FILE_ATTRIBUTE_NORMAL)+                    nullPtr++foreign import WINDOWS_CCONV unsafe "windows.h CloseHandle"+  c_closeHandle  :: Ptr () -> IO Bool++foreign import WINDOWS_CCONV unsafe "windows.h GetFinalPathNameByHandleW"+  c_getFinalPathHandle :: Ptr () -> CWString -> Word32 -> Word32 -> IO Word32  -------------------------------------------------------------------------------- -- Fallback to argv[0]
System/IO.hs view
@@ -224,8 +224,11 @@ import Data.Bits import Data.Maybe import Foreign.C.Error-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) import Foreign.C.String+import Foreign.Ptr+import Foreign.Marshal.Alloc+import Foreign.Storable #endif import Foreign.C.Types import System.Posix.Internals@@ -233,7 +236,9 @@  import GHC.Base import GHC.List+#ifndef mingw32_HOST_OS import GHC.IORef+#endif import GHC.Num import GHC.IO hiding ( bracket, onException ) import GHC.IO.IOMode@@ -400,10 +405,15 @@ -- --------------------------------------------------------------------------- -- fixIO +-- | The implementation of 'mfix' for 'IO'. If the function passed+-- to 'fixIO' inspects its argument, the resulting action will throw+-- 'FixIOException'. fixIO :: (a -> IO a) -> IO a fixIO k = do     m <- newEmptyMVar-    ans <- unsafeInterleaveIO (takeMVar m)+    ans <- unsafeDupableInterleaveIO+             (readMVar m `catch` \BlockedIndefinitelyOnMVar ->+                                    throwIO FixIOException)     result <- k ans     putMVar m result     return result@@ -413,13 +423,19 @@ -- computation a few times before it notices the loop, which is wrong. -- -- NOTE2: the explicit black-holing with an IORef ran into trouble--- with multiple threads (see #5421), so now we use an MVar.  I'm--- actually wondering whether we should use readMVar rather than--- takeMVar, just in case it ends up being executed multiple times,--- but even then it would have to be masked to protect against async--- exceptions.  Ugh.  What we really need here is an IVar, or an--- atomic readMVar, or even STM.  All these seem like overkill.+-- with multiple threads (see #5421), so now we use an MVar. We used+-- to use takeMVar with unsafeInterleaveIO. This, however, uses noDuplicate#,+-- which is not particularly cheap. Better to use readMVar, which can be+-- performed in multiple threads safely, and to use unsafeDupableInterleaveIO+-- to avoid the noDuplicate cost. --+-- What we'd ideally want is probably an IVar, but we don't quite have those.+-- STM TVars look like an option at first, but I don't think they are:+-- we'd need to be able to write to the variable in an IO context, which can+-- only be done using 'atomically', and 'atomically' is not allowed within+-- unsafePerformIO. We can't know if someone will try to use the result+-- of fixIO with unsafePerformIO!+-- -- See also System.IO.Unsafe.unsafeFixIO. -- @@ -467,14 +483,14 @@ openTempFile' :: String -> FilePath -> String -> Bool -> CMode               -> IO (FilePath, Handle) openTempFile' loc tmp_dir template binary mode-    | pathSeparator `elem` template+    | pathSeparator template     = fail $ "openTempFile': Template string must not contain path separator characters: "++template     | otherwise = findTempName   where     -- We split off the last extension, so we can use .foo.ext files     -- for temporary files (hidden on Unix OSes). Unfortunately we're     -- below filepath in the hierarchy here.-    (prefix,suffix) =+    (prefix, suffix) =        case break (== '.') $ reverse template of          -- First case: template contains no '.'s. Just re-reverse it.          (rev_suffix, "")       -> (reverse rev_suffix, "")@@ -487,7 +503,52 @@          -- always return a pair with either the empty string or a string          -- beginning with '.' as the second component.          _                      -> errorWithoutStackTrace "bug in System.IO.openTempFile"+#if defined(mingw32_HOST_OS)+    findTempName = do+      let label = if null prefix then "ghc" else prefix+      withCWString tmp_dir $ \c_tmp_dir ->+        withCWString label $ \c_template ->+          withCWString suffix $ \c_suffix ->+            -- NOTE: revisit this when new I/O manager in place and use a UUID+            --       based one when we are no longer MAX_PATH bound.+            allocaBytes (sizeOf (undefined :: CWchar) * 260) $ \c_str -> do+            res <- c_getTempFileNameErrorNo c_tmp_dir c_template c_suffix 0+                                            c_str+            if not res+               then do errno <- getErrno+                       ioError (errnoToIOError loc errno Nothing (Just tmp_dir))+               else do filename <- peekCWString c_str+                       handleResults filename +    handleResults filename = do+      let oflags1 = rw_flags .|. o_EXCL+          binary_flags+              | binary    = o_BINARY+              | otherwise = 0+          oflags = oflags1 .|. binary_flags+      fd <- withFilePath filename $ \ f -> c_open f oflags mode+      case fd < 0 of+        True -> do errno <- getErrno+                   ioError (errnoToIOError loc errno Nothing (Just tmp_dir))+        False ->+          do (fD,fd_type) <- FD.mkFD fd ReadWriteMode Nothing{-no stat-}+                                     False{-is_socket-}+                                     True{-is_nonblock-}++             enc <- getLocaleEncoding+             h <- mkHandleFromFD fD fd_type filename ReadWriteMode+                                 False{-set non-block-} (Just enc)++             return (filename, h)++foreign import ccall "getTempFileNameErrorNo" c_getTempFileNameErrorNo+  :: CWString -> CWString -> CWString -> CUInt -> Ptr CWchar -> IO Bool++pathSeparator :: String -> Bool+pathSeparator template = any (\x-> x == '/' || x == '\\') template++output_flags = std_flags+#else /* else mingw32_HOST_OS */     findTempName = do       rs <- rand_string       let filename = prefix ++ rs ++ suffix@@ -511,8 +572,8 @@         combine a b                   | null b = a                   | null a = b-                  | last a == pathSeparator = a ++ b-                  | otherwise = a ++ [pathSeparator] ++ b+                  | pathSeparator [last a] = a ++ b+                  | otherwise = a ++ [pathSeparatorChar] ++ b  tempCounter :: IORef Int tempCounter = unsafePerformIO $ newIORef 0@@ -546,41 +607,22 @@       errno <- getErrno       case errno of         _ | errno == eEXIST -> return FileExists-#ifdef mingw32_HOST_OS-        -- If c_open throws EACCES on windows, it could mean that filepath is a-        -- directory. In this case, we want to return FileExists so that the-        -- enclosing openTempFile can try again instead of failing outright.-        -- See bug #4968.-        _ | errno == eACCES -> do-          withCString filepath $ \path -> do-            -- There is a race here: the directory might have been moved or-            -- deleted between the c_open call and the next line, but there-            -- doesn't seem to be any direct way to detect that the c_open call-            -- failed because of an existing directory.-            exists <- c_fileExists path-            return $ if exists-              then FileExists-              else OpenNewError errno-#endif         _ -> return (OpenNewError errno)     else return (NewFileCreated fd) -#ifdef mingw32_HOST_OS-foreign import ccall "file_exists" c_fileExists :: CString -> IO Bool-#endif- -- XXX Should use filepath library-pathSeparator :: Char-#ifdef mingw32_HOST_OS-pathSeparator = '\\'-#else-pathSeparator = '/'-#endif+pathSeparatorChar :: Char+pathSeparatorChar = '/' +pathSeparator :: String -> Bool+pathSeparator template = pathSeparatorChar `elem` template++output_flags = std_flags    .|. o_CREAT+#endif /* mingw32_HOST_OS */+ -- XXX Copied from GHC.Handle std_flags, output_flags, rw_flags :: CInt std_flags    = o_NONBLOCK   .|. o_NOCTTY-output_flags = std_flags    .|. o_CREAT rw_flags     = output_flags .|. o_RDWR  -- $locking@@ -600,4 +642,3 @@ -- It follows that an attempt to write to a file (using 'writeFile', for -- example) that was earlier opened by 'readFile' will usually result in -- failure with 'System.IO.Error.isAlreadyInUseError'.-
System/Posix/Internals.hs view
@@ -43,7 +43,7 @@ import GHC.IO.IOMode import GHC.IO.Exception import GHC.IO.Device-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS) import {-# SOURCE #-} GHC.IO.Encoding (getFileSystemEncoding) import qualified GHC.Foreign as GHC #endif@@ -157,7 +157,7 @@      return mode -#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) withFilePath :: FilePath -> (CWString -> IO a) -> IO a withFilePath = withCWString @@ -545,7 +545,7 @@  foreign import ccall unsafe "HsBase.h __hscore_sizeof_stat" sizeof_stat :: Int foreign import ccall unsafe "HsBase.h __hscore_st_mtime" st_mtime :: Ptr CStat -> IO CTime-#ifdef mingw32_HOST_OS+#if defined(mingw32_HOST_OS) foreign import ccall unsafe "HsBase.h __hscore_st_size" st_size :: Ptr CStat -> IO Int64 #else foreign import ccall unsafe "HsBase.h __hscore_st_size" st_size :: Ptr CStat -> IO COff
System/Timeout.hs view
@@ -18,7 +18,7 @@  module System.Timeout ( timeout ) where -#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS) import Control.Monad import GHC.Event           (getSystemTimerManager,                             registerTimeout, unregisterTimeout)@@ -53,6 +53,12 @@ -- timeout interval means \"wait indefinitely\". When specifying long timeouts, -- be careful not to exceed @maxBound :: Int@. --+-- >>> timeout 1000000 (threadDelay 1000 *> pure "finished on time")+-- Just "finished on time"+--+-- >>> timeout 10000 (threadDelay 100000 *> pure "finished on time")+-- Nothing+-- -- The design of this combinator was guided by the objective that @timeout n f@ -- should behave exactly the same as @f@ as long as @f@ doesn't time out. This -- means that @f@ has the same 'myThreadId' it would have without the timeout@@ -75,12 +81,11 @@ -- because the runtime system uses scheduling mechanisms like @select(2)@ to -- perform asynchronous I\/O, so it is possible to interrupt standard socket -- I\/O or file I\/O using this combinator.- timeout :: Int -> IO a -> IO (Maybe a) timeout n f     | n <  0    = fmap Just f     | n == 0    = return Nothing-#ifndef mingw32_HOST_OS+#if !defined(mingw32_HOST_OS)     | rtsSupportsBoundThreads = do         -- In the threaded RTS, we use the Timer Manager to delay the         -- (fairly expensive) 'forkIO' call until the timeout has expired.
Text/ParserCombinators/ReadP.hs view
@@ -161,8 +161,6 @@  newtype ReadP a = R (forall b . (a -> P b) -> P b) --- Functor, Monad, MonadPlus- -- | @since 2.01 instance Functor ReadP where   fmap h (R f) = R (\k -> f (k . h))@@ -171,7 +169,7 @@ instance Applicative ReadP where     pure x = R (\k -> k x)     (<*>) = ap-    liftA2 = liftM2+    -- liftA2 = liftM2  -- | @since 2.01 instance Monad ReadP where@@ -286,7 +284,7 @@  munch :: (Char -> Bool) -> ReadP String -- ^ Parses the first zero or more characters satisfying the predicate.---   Always succeds, exactly once having consumed all the characters+--   Always succeeds, exactly once having consumed all the characters --   Hence NOT the same as (many (satisfy p)) munch p =   do s <- look@@ -439,85 +437,68 @@ These can be seen as formal specifications of the behavior of the combinators. -We use bags to give semantics to the combinators.+For some values, we only care about the lists contents, not their order, ->  type Bag a = [a]+> (=~) :: Ord a => [a] -> [a] -> Bool+> xs =~ ys = sort xs == sort ys -Equality on bags does not care about the order of elements.+Here follow the properties: ->  (=~) :: Ord a => Bag a -> Bag a -> Bool->  xs =~ ys = sort xs == sort ys+>>> readP_to_S get []+[] -A special equality operator to avoid unresolved overloading-when testing the properties.+prop> \c str -> readP_to_S get (c:str) == [(c, str)] ->  (=~.) :: Bag (Int,String) -> Bag (Int,String) -> Bool->  (=~.) = (=~)+prop> \str -> readP_to_S look str == [(str, str)] -Here follow the properties:+prop> \str -> readP_to_S pfail str == [] ->  prop_Get_Nil =->    readP_to_S get [] =~ []->->  prop_Get_Cons c s =->    readP_to_S get (c:s) =~ [(c,s)]->->  prop_Look s =->    readP_to_S look s =~ [(s,s)]->->  prop_Fail s =->    readP_to_S pfail s =~. []->->  prop_Return x s =->    readP_to_S (return x) s =~. [(x,s)]->->  prop_Bind p k s =->    readP_to_S (p >>= k) s =~.+prop> \x str -> readP_to_S (return x) s == [(x,s)]++> prop_Bind p k s =+>    readP_to_S (p >>= k) s =~ >      [ ys'' >      | (x,s') <- readP_to_S p s >      , ys''   <- readP_to_S (k (x::Int)) s' >      ]->->  prop_Plus p q s =->    readP_to_S (p +++ q) s =~.->      (readP_to_S p s ++ readP_to_S q s)->->  prop_LeftPlus p q s =->    readP_to_S (p <++ q) s =~.->      (readP_to_S p s +<+ readP_to_S q s)->   where->    [] +<+ ys = ys->    xs +<+ _  = xs->->  prop_Gather s =->    forAll readPWithoutReadS $ \p ->->      readP_to_S (gather p) s =~->        [ ((pre,x::Int),s')->        | (x,s') <- readP_to_S p s->        , let pre = take (length s - length s') s->        ]->->  prop_String_Yes this s =->    readP_to_S (string this) (this ++ s) =~->      [(this,s)]->->  prop_String_Maybe this s =->    readP_to_S (string this) s =~->      [(this, drop (length this) s) | this `isPrefixOf` s]->->  prop_Munch p s =->    readP_to_S (munch p) s =~->      [(takeWhile p s, dropWhile p s)]->->  prop_Munch1 p s =->    readP_to_S (munch1 p) s =~->      [(res,s') | let (res,s') = (takeWhile p s, dropWhile p s), not (null res)]->->  prop_Choice ps s =->    readP_to_S (choice ps) s =~.->      readP_to_S (foldr (+++) pfail ps) s->->  prop_ReadS r s =->    readP_to_S (readS_to_P r) s =~. r s--} +> prop_Plus p q s =+>   readP_to_S (p +++ q) s =~+>     (readP_to_S p s ++ readP_to_S q s)++> prop_LeftPlus p q s =+>   readP_to_S (p <++ q) s =~+>     (readP_to_S p s +<+ readP_to_S q s)+>  where+>   [] +<+ ys = ys+>   xs +<+ _  = xs++> prop_Gather s =+>   forAll readPWithoutReadS $ \p ->+>     readP_to_S (gather p) s =~+>       [ ((pre,x::Int),s')+>       | (x,s') <- readP_to_S p s+>       , let pre = take (length s - length s') s+>       ]++prop> \this str -> readP_to_S (string this) (this ++ str) == [(this,str)]++> prop_String_Maybe this s =+>   readP_to_S (string this) s =~+>     [(this, drop (length this) s) | this `isPrefixOf` s]++> prop_Munch p s =+>   readP_to_S (munch p) s =~+>     [(takeWhile p s, dropWhile p s)]++> prop_Munch1 p s =+>   readP_to_S (munch1 p) s =~+>     [(res,s') | let (res,s') = (takeWhile p s, dropWhile p s), not (null res)]++> prop_Choice ps s =+>   readP_to_S (choice ps) s =~+>     readP_to_S (foldr (+++) pfail ps) s++> prop_ReadS r s =+>   readP_to_S (readS_to_P r) s =~ r s+-}
Text/Printf.hs view
@@ -102,6 +102,10 @@ -------------------  -- | Format a variable number of arguments with the C-style formatting string.+--+-- >>> printf "%s, %d, %.4f" "hello" 123 pi+-- hello, 123, 3.1416+-- -- The return value is either 'String' or @('IO' a)@ (which -- should be @('IO' '()')@, but Haskell's type system -- makes this hard).@@ -133,11 +137,11 @@ -- A conversion specification begins with the -- character @%@, followed by zero or more of the following flags: ----- >    -      left adjust (default is right adjust)--- >    +      always use a sign (+ or -) for signed conversions--- >    space  leading space for positive numbers in signed conversions--- >    0      pad with zeros rather than spaces--- >    #      use an \"alternate form\": see below+-- > -      left adjust (default is right adjust)+-- > +      always use a sign (+ or -) for signed conversions+-- > space  leading space for positive numbers in signed conversions+-- > 0      pad with zeros rather than spaces+-- > #      use an \"alternate form\": see below -- -- When both flags are given, @-@ overrides @0@ and @+@ overrides space. -- A negative width specifier in a @*@ conversion is treated as@@ -146,32 +150,32 @@ -- The \"alternate form\" for unsigned radix conversions is -- as in C @printf(3)@: ----- >    %o           prefix with a leading 0 if needed--- >    %x           prefix with a leading 0x if nonzero--- >    %X           prefix with a leading 0X if nonzero--- >    %b           prefix with a leading 0b if nonzero--- >    %[eEfFgG]    ensure that the number contains a decimal point+-- > %o           prefix with a leading 0 if needed+-- > %x           prefix with a leading 0x if nonzero+-- > %X           prefix with a leading 0X if nonzero+-- > %b           prefix with a leading 0b if nonzero+-- > %[eEfFgG]    ensure that the number contains a decimal point -- -- Any flags are followed optionally by a field width: ----- >    num    field width--- >    *      as num, but taken from argument list+-- > num    field width+-- > *      as num, but taken from argument list -- -- The field width is a minimum, not a maximum: it will be -- expanded as needed to avoid mutilating a value. -- -- Any field width is followed optionally by a precision: ----- >    .num   precision--- >    .      same as .0--- >    .*     as num, but taken from argument list+-- > .num   precision+-- > .      same as .0+-- > .*     as num, but taken from argument list -- -- Negative precision is taken as 0. The meaning of the -- precision depends on the conversion type. ----- >    Integral    minimum number of digits to show--- >    RealFloat   number of digits after the decimal point--- >    String      maximum number of characters+-- > Integral    minimum number of digits to show+-- > RealFloat   number of digits after the decimal point+-- > String      maximum number of characters -- -- The precision for Integral types is accomplished by zero-padding. -- If both precision and zero-pad are given for an Integral field,@@ -182,29 +186,29 @@ -- to set the implicit size of the operand for conversion of -- a negative operand to unsigned: ----- >    hh     Int8--- >    h      Int16--- >    l      Int32--- >    ll     Int64--- >    L      Int64+-- > hh     Int8+-- > h      Int16+-- > l      Int32+-- > ll     Int64+-- > L      Int64 -- -- The specification ends with a format character: ----- >    c      character               Integral--- >    d      decimal                 Integral--- >    o      octal                   Integral--- >    x      hexadecimal             Integral--- >    X      hexadecimal             Integral--- >    b      binary                  Integral--- >    u      unsigned decimal        Integral--- >    f      floating point          RealFloat--- >    F      floating point          RealFloat--- >    g      general format float    RealFloat--- >    G      general format float    RealFloat--- >    e      exponent format float   RealFloat--- >    E      exponent format float   RealFloat--- >    s      string                  String--- >    v      default format          any type+-- > c      character               Integral+-- > d      decimal                 Integral+-- > o      octal                   Integral+-- > x      hexadecimal             Integral+-- > X      hexadecimal             Integral+-- > b      binary                  Integral+-- > u      unsigned decimal        Integral+-- > f      floating point          RealFloat+-- > F      floating point          RealFloat+-- > g      general format float    RealFloat+-- > G      general format float    RealFloat+-- > e      exponent format float   RealFloat+-- > E      exponent format float   RealFloat+-- > s      string                  String+-- > v      default format          any type -- -- The \"%v\" specifier is provided for all built-in types, -- and should be provided for user-defined type formatters@@ -212,11 +216,11 @@ -- type. For the built-in types the \"%v\" specifier is -- converted as follows: ----- >    c      Char--- >    u      other unsigned Integral--- >    d      other signed Integral--- >    g      RealFloat--- >    s      String+-- > c      Char+-- > u      other unsigned Integral+-- > d      other signed Integral+-- > g      RealFloat+-- > s      String -- -- Mismatch between the argument types and the format -- string, as well as any other syntactic or semantic errors@@ -246,16 +250,6 @@ -- -- * Haskell 'printf' will place a zero after a decimal point when --   possible.------ ==== __Examples__------ >   > printf "%d\n" (23::Int)--- >   23--- >   > printf "%s %s\n" "Hello" "World"--- >   Hello World--- >   > printf "%.2f\n" pi--- >   3.14--- printf :: (PrintfType r) => String -> r printf fmts = spr fmts [] 
Text/Read.hs view
@@ -62,6 +62,12 @@ -- Succeeds if there is exactly one valid result. -- A 'Left' value indicates a parse error. --+-- >>> readEither "123" :: Either String Int+-- Right 123+--+-- >>> readEither "hello" :: Either String Int+-- Left "Prelude.read: no parse"+-- -- @since 4.6.0.0 readEither :: Read a => String -> Either String a readEither s =@@ -78,6 +84,12 @@ -- | Parse a string using the 'Read' instance. -- Succeeds if there is exactly one valid result. --+-- >>> readMaybe "123" :: Maybe Int+-- Just 123+--+-- >>> readMaybe "hello" :: Maybe Int+-- Nothing+-- -- @since 4.6.0.0 readMaybe :: Read a => String -> Maybe a readMaybe s = case readEither s of@@ -85,6 +97,14 @@                 Right a -> Just a  -- | The 'read' function reads input from a string, which must be--- completely consumed by the input process.+-- completely consumed by the input process. 'read' fails with an 'error' if the+-- parse is unsuccessful, and it is therefore discouraged from being used in+-- real applications. Use 'readMaybe' or 'readEither' for safe alternatives.+--+-- >>> read "123" :: Int+-- 123+--+-- >>> read "hello" :: Int+-- *** Exception: Prelude.read: no parse read :: Read a => String -> a read s = either errorWithoutStackTrace id (readEither s)
Type/Reflection/Unsafe.hs view
@@ -12,6 +12,7 @@ -- type representations. -- -----------------------------------------------------------------------------+{-# LANGUAGE TypeInType, ScopedTypeVariables #-}  module Type.Reflection.Unsafe (       -- * Type representations@@ -22,4 +23,12 @@     , TyCon, mkTrCon, tyConKindRep, tyConKindArgs, tyConFingerprint   ) where -import Data.Typeable.Internal+import Data.Typeable.Internal hiding (mkTrApp)+import qualified Data.Typeable.Internal as TI++-- | Construct a representation for a type application.+mkTrApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1).+           TypeRep (a :: k1 -> k2)+        -> TypeRep (b :: k1)+        -> TypeRep (a b)+mkTrApp = TI.mkTrAppChecked
base.cabal view
@@ -1,18 +1,18 @@-cabal-version:  2.0+cabal-version:  2.2 name:           base-version:        4.10.1.0+version:        4.11.0.0 -license:        BSD3+license:        BSD-3-Clause license-file:   LICENSE maintainer:     libraries@haskell.org bug-reports:    http://ghc.haskell.org/trac/ghc/newticket?component=libraries/base synopsis:       Basic libraries category:       Prelude-build-type:     Configure description:-    This package contains the Standard Haskell "Prelude" and its support libraries,+    This package contains the "Prelude" and its support libraries,     and a large collection of useful libraries ranging from data     structures to parsing combinators and debugging utilities.+build-type:     Configure  extra-tmp-files:     autom4te.cache@@ -93,17 +93,17 @@         UnliftedFFITypes         Unsafe -    build-depends: rts == 1.0, ghc-prim ^>= 0.5.1.0+    build-depends: rts == 1.0.*, ghc-prim == 0.5.*      -- sanity-check to ensure exactly one flag is set     if !((flag(integer-gmp) && !flag(integer-simple)) || (!flag(integer-gmp) && flag(integer-simple)))         build-depends: invalid-cabal-flag-settings<0      if flag(integer-simple)-        build-depends: integer-simple ^>= 0.1.1+        build-depends: integer-simple >= 0.1.1 && < 0.2      if flag(integer-gmp)-        build-depends: integer-gmp ^>= 1.0.1+        build-depends: integer-gmp >= 1.0 && < 1.1         cpp-options: -DOPTIMISE_INTEGER_GCD_LCM      exposed-modules:@@ -202,7 +202,9 @@         Foreign.Storable         GHC.Arr         GHC.Base+        GHC.ByteOrder         GHC.Char+        GHC.Clock         GHC.Conc         GHC.Conc.IO         GHC.Conc.Signal@@ -288,6 +290,7 @@         System.CPUTime         System.Console.GetOpt         System.Environment+        System.Environment.Blank         System.Exit         System.IO         System.IO.Error@@ -315,6 +318,7 @@         Control.Monad.ST.Lazy.Imp         Data.Functor.Utils         Data.OldList+        Data.Semigroup.Internal         Data.Typeable.Internal         Foreign.ForeignPtr.Imp         GHC.StaticPtr.Internal@@ -334,6 +338,9 @@         cbits/primFloat.c         cbits/sysconf.c +    cmm-sources:+        cbits/CastFloatWord.cmm+     include-dirs: include     includes:         HsBase.h@@ -366,7 +373,6 @@         other-modules:             GHC.Event.Arr             GHC.Event.Array-            GHC.Event.Clock             GHC.Event.Control             GHC.Event.EPoll             GHC.Event.IntTable
cbits/SetEnv.c view
@@ -1,7 +1,7 @@ #include "HsBase.h"-#ifdef HAVE_UNSETENV+#if defined(HAVE_UNSETENV) int __hsbase_unsetenv(const char *name) {-#ifdef UNSETENV_RETURNS_VOID+#if defined(UNSETENV_RETURNS_VOID)     unsetenv(name);     return 0; #else
cbits/Win32Utils.c view
@@ -1,12 +1,16 @@ /* ----------------------------------------------------------------------------    (c) The University of Glasgow 2006-   +    Useful Win32 bits    ------------------------------------------------------------------------- */  #if defined(_WIN32)  #include "HsBase.h"+#include <stdbool.h>+#include <stdint.h>+#include <wchar.h>+#include <windows.h>  /* This is the error table that defines the mapping between OS error    codes and errno values */@@ -148,4 +152,43 @@     return r != INVALID_FILE_ATTRIBUTES; } +bool getTempFileNameErrorNo (wchar_t* pathName, wchar_t* prefix,+                             wchar_t* suffix, uint32_t uUnique,+                             wchar_t* tempFileName)+{+  if (!GetTempFileNameW(pathName, prefix, uUnique, tempFileName))+    {+      maperrno();+      return false;+    }++  wchar_t* drive = malloc (sizeof(wchar_t) * _MAX_DRIVE);+  wchar_t* dir   = malloc (sizeof(wchar_t) * _MAX_DIR);+  wchar_t* fname = malloc (sizeof(wchar_t) * _MAX_FNAME);+  bool success = true;+  if (_wsplitpath_s (tempFileName, drive, _MAX_DRIVE, dir, _MAX_DIR,+                     fname, _MAX_FNAME, NULL, 0) != 0)+    {+      success = false;+      maperrno ();+    }+  else+    {+      wchar_t* temp = _wcsdup (tempFileName);+      if (wcsnlen(drive, _MAX_DRIVE) == 0)+        swprintf_s(tempFileName, MAX_PATH, L"%s\%s%s",+                   dir, fname, suffix);+      else+        swprintf_s(tempFileName, MAX_PATH, L"%s\%s\%s%s",+                   drive, dir, fname, suffix);+      MoveFileW(temp, tempFileName);+      free(temp);+    }++  free(drive);+  free(dir);+  free(fname);++  return success;+} #endif
cbits/iconv.c view
@@ -1,4 +1,4 @@-#ifndef _WIN32+#if !defined(_WIN32)  #include <stdlib.h> #include <iconv.h>
cbits/inputReady.c view
@@ -1,216 +1,411 @@-/* +/*  * (c) The GRASP/AQUA Project, Glasgow University, 1994-2002  *  * hWaitForInput Runtime Support  */ +/* FD_SETSIZE defaults to 64 on Windows, which makes even the most basic+ * programs break that use select() on a socket FD.+ * Thus we raise it here (before any #include of network-related headers)+ * to 1024 so that at least those programs would work that would work on+ * Linux if that used select() (luckily it uses poll() by now).+ * See https://ghc.haskell.org/trac/ghc/ticket/13497#comment:23+ * The real solution would be to remove all uses of select()+ * on Windows, too, and use IO Completion Ports instead.+ * Note that on Windows, one can simply define FD_SETSIZE to the desired+ * size before including Winsock2.h, as described here:+ *   https://msdn.microsoft.com/en-us/library/windows/desktop/ms740141(v=vs.85).aspx+ */+#if defined(_WIN32)+#define FD_SETSIZE 1024+#endif+ /* select and supporting types is not Posix */ /* #include "PosixSource.h" */+#include <limits.h>+#include <stdbool.h> #include "HsBase.h"+#include "Rts.h" #if !defined(_WIN32) #include <poll.h>-#include <sys/time.h> #endif  /*+ * Returns a timeout suitable to be passed into poll().+ *+ * If `infinite`, `remaining` is ignored.+ */+static inline+int+compute_poll_timeout(bool infinite, Time remaining)+{+    if (infinite) return -1;++    if (remaining < 0) return 0;++    if (remaining > MSToTime(INT_MAX)) return INT_MAX;++    return TimeToMS(remaining);+}++#if defined(_WIN32)+/*+ * Returns a timeout suitable to be passed into select() on Windows.+ *+ * The given `remaining_tv` serves as a storage for the timeout+ * when needed, but callers should use the returned value instead+ * as it will not be filled in all cases.+ *+ * If `infinite`, `remaining` is ignored and `remaining_tv` not touched+ * (and may be passed as NULL in that case).+ */+static inline+struct timeval *+compute_windows_select_timeout(bool infinite, Time remaining,+                               /* out */ struct timeval * remaining_tv)+{+    if (infinite) {+        return NULL;+    }++    ASSERT(remaining_tv);++    if (remaining < 0) {+        remaining_tv->tv_sec = 0;+        remaining_tv->tv_usec = 0;+    } else if (remaining > MSToTime(LONG_MAX)) {+        remaining_tv->tv_sec = LONG_MAX;+        remaining_tv->tv_usec = LONG_MAX;+    } else {+        remaining_tv->tv_sec  = TimeToMS(remaining) / 1000;+        remaining_tv->tv_usec = TimeToUS(remaining) % 1000000;+    }++    return remaining_tv;+}++/*+ * Returns a timeout suitable to be passed into WaitForSingleObject() on+ * Windows.+ *+ * If `infinite`, `remaining` is ignored.+ */+static inline+DWORD+compute_WaitForSingleObject_timeout(bool infinite, Time remaining)+{+    // WaitForSingleObject() has the fascinating delicacy behaviour+    // that it waits indefinitely if the `DWORD dwMilliseconds`+    // is set to 0xFFFFFFFF (the maximum DWORD value), which is+    // 4294967295 seconds == ~49.71 days+    // (the Windows API calls this constant INFINITE...).+    //   https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx+    //+    // We ensure that if accidentally `remaining == 4294967295`, it does+    // NOT wait forever, by never passing that value to+    // WaitForSingleObject() (so, never returning it from this function),+    // unless `infinite`.++    if (infinite) return INFINITE;++    if (remaining < 0) return 0;++    if (remaining >= MSToTime(INFINITE)) return INFINITE - 1;++    return (DWORD) TimeToMS(remaining);+}+#endif++/*  * inputReady(fd) checks to see whether input is available on the file  * descriptor 'fd' within 'msecs' milliseconds (or indefinitely if 'msecs' is  * negative). "Input is available" is defined as 'can I safely read at least a- * *character* from this file object without blocking?'+ * *character* from this file object without blocking?' (this does not work+ * reliably on Linux when the fd is a not-O_NONBLOCK socket, so if you pass+ * socket fds to this function, ensure they have O_NONBLOCK;+ * see `man 2 poll` and `man 2 select`, and+ * https://ghc.haskell.org/trac/ghc/ticket/13497#comment:26).+ *+ * This function blocks until either `msecs` have passed, or input is+ * available.+ *+ * Returns:+ *   1 => Input ready, 0 => not ready, -1 => error+ * On error, sets `errno`.  */ int-fdReady(int fd, int write, int msecs, int isSock)+fdReady(int fd, int write, int64_t msecs, int isSock) {--#if !defined(_WIN32)-    struct pollfd fds[1];+    bool infinite = msecs < 0; -    // if we need to track the then record the current time in case we are+    // if we need to track the time then record the end time in case we are     // interrupted.-    struct timeval tv0;+    Time endTime = 0;     if (msecs > 0) {-        if (gettimeofday(&tv0, NULL) != 0) {-            fprintf(stderr, "fdReady: gettimeofday failed: %s\n",-                    strerror(errno));-            abort();-        }+        endTime = getProcessElapsedTime() + MSToTime(msecs);     } +    // Invariant of all code below:+    // If `infinite`, then `remaining` and `endTime` are never used.++    Time remaining = MSToTime(msecs);++#if !defined(_WIN32)+    struct pollfd fds[1];+     fds[0].fd = fd;     fds[0].events = write ? POLLOUT : POLLIN;     fds[0].revents = 0; -    int res;-    while ((res = poll(fds, 1, msecs)) < 0) {-        if (errno == EINTR) {-            if (msecs > 0) {-                struct timeval tv;-                if (gettimeofday(&tv, NULL) != 0) {-                    fprintf(stderr, "fdReady: gettimeofday failed: %s\n",-                            strerror(errno));-                    abort();-                }+    // The code below tries to make as few syscalls as possible;+    // in particular, it eschews getProcessElapsedTime() calls+    // when `infinite` or `msecs == 0`. -                int elapsed = 1000 * (tv.tv_sec - tv0.tv_sec)-                            + (tv.tv_usec - tv0.tv_usec) / 1000;-                msecs -= elapsed;-                if (msecs <= 0) return 0;-                tv0 = tv;-            }-        } else {-            return (-1);+    // We need to wait in a loop because poll() accepts `int` but `msecs` is+    // `int64_t`, and because signals can interrupt it.++    while (true) {+        int res = poll(fds, 1, compute_poll_timeout(infinite, remaining));++        if (res < 0 && errno != EINTR)+            return (-1); // real error; errno is preserved++        if (res > 0)+            return 1; // FD has new data++        if (res == 0 && !infinite && remaining <= MSToTime(INT_MAX))+            return 0; // FD has no new data and we've waited the full msecs++        // Non-exit cases+        CHECK( ( res < 0 && errno == EINTR ) || // EINTR happened+               // need to wait more+               ( res == 0 && (infinite ||+                              remaining > MSToTime(INT_MAX)) ) );++        if (!infinite) {+            Time now = getProcessElapsedTime();+            if (now >= endTime) return 0;+            remaining = endTime - now;         }     } -    // res is the number of FDs with events-    return (res > 0);- #else      if (isSock) {-	int maxfd, ready;-	fd_set rfd, wfd;-	struct timeval tv;+        int maxfd;+        fd_set rfd, wfd;+        struct timeval remaining_tv;+         if ((fd >= (int)FD_SETSIZE) || (fd < 0)) {-            fprintf(stderr, "fdReady: fd is too big");-            abort();+            barf("fdReady: fd is too big: %d but FD_SETSIZE is %d", fd, (int)FD_SETSIZE);         }-	FD_ZERO(&rfd);-	FD_ZERO(&wfd);+        FD_ZERO(&rfd);+        FD_ZERO(&wfd);         if (write) {             FD_SET(fd, &wfd);         } else {             FD_SET(fd, &rfd);         }-	-	/* select() will consider the descriptor set in the range of 0 to-	 * (maxfd-1) -	 */-	maxfd = fd + 1;-	tv.tv_sec  = msecs / 1000;-	tv.tv_usec = (msecs % 1000) * 1000;-	-	while ((ready = select(maxfd, &rfd, &wfd, NULL, &tv)) < 0 ) {-	    if (errno != EINTR ) {-		return -1;-	    }-	}-	-	/* 1 => Input ready, 0 => not ready, -1 => error */-	return (ready);-    }-    else {-	DWORD rc;-	HANDLE hFile = (HANDLE)_get_osfhandle(fd);-	DWORD avail; -        switch (GetFileType(hFile)) {+        /* select() will consider the descriptor set in the range of 0 to+         * (maxfd-1)+         */+        maxfd = fd + 1; -        case FILE_TYPE_CHAR:-        {-            INPUT_RECORD buf[1];-            DWORD count;+        // We need to wait in a loop because the `timeval` `tv_*` members+        // passed into select() accept are `long` (which is 32 bits on 32-bit+        // and 64-bit Windows), but `msecs` is `int64_t`, and because signals+        // can interrupt it.+        //   https://msdn.microsoft.com/en-us/library/windows/desktop/ms740560(v=vs.85).aspx+        //   https://stackoverflow.com/questions/384502/what-is-the-bit-size-of-long-on-64-bit-windows#384672 -            // nightmare.  A Console Handle will appear to be ready-            // (WaitForSingleObject() returned WAIT_OBJECT_0) when-            // it has events in its input buffer, but these events might-            // not be keyboard events, so when we read from the Handle the-            // read() will block.  So here we try to discard non-keyboard-            // events from a console handle's input buffer and then try-            // the WaitForSingleObject() again.+        while (true) {+            int res = select(maxfd, &rfd, &wfd, NULL,+                             compute_windows_select_timeout(infinite, remaining,+                                                            &remaining_tv)); -            while (1) // keep trying until we find a real key event-            {-                rc = WaitForSingleObject( hFile, msecs );-                switch (rc) {-                case WAIT_TIMEOUT: return 0;-                case WAIT_OBJECT_0: break;-                default: /* WAIT_FAILED */ maperrno(); return -1;-                }+            if (res < 0 && errno != EINTR)+                return (-1); // real error; errno is preserved -                while (1) // discard non-key events+            if (res > 0)+                return 1; // FD has new data++            if (res == 0 && !infinite && remaining <= MSToTime(INT_MAX))+                return 0; // FD has no new data and we've waited the full msecs++            // Non-exit cases+            CHECK( ( res < 0 && errno == EINTR ) || // EINTR happened+                   // need to wait more+                   ( res == 0 && (infinite ||+                                  remaining > MSToTime(INT_MAX)) ) );++            if (!infinite) {+                Time now = getProcessElapsedTime();+                if (now >= endTime) return 0;+                remaining = endTime - now;+            }+        }++    } else {+        DWORD rc;+        HANDLE hFile = (HANDLE)_get_osfhandle(fd);+        DWORD avail = 0;++        switch (GetFileType(hFile)) {++            case FILE_TYPE_CHAR:                 {-                    rc = PeekConsoleInput(hFile, buf, 1, &count);-                    // printf("peek, rc=%d, count=%d, type=%d\n", rc, count, buf[0].EventType);-                    if (rc == 0) {-                        rc = GetLastError();-                        if (rc == ERROR_INVALID_HANDLE || rc == ERROR_INVALID_FUNCTION) {-                            return 1;-                        } else {-                            maperrno();-                            return -1;-                        }-                    }+                    INPUT_RECORD buf[1];+                    DWORD count; -                    if (count == 0) break; // no more events => wait again+                    // nightmare.  A Console Handle will appear to be ready+                    // (WaitForSingleObject() returned WAIT_OBJECT_0) when+                    // it has events in its input buffer, but these events might+                    // not be keyboard events, so when we read from the Handle the+                    // read() will block.  So here we try to discard non-keyboard+                    // events from a console handle's input buffer and then try+                    // the WaitForSingleObject() again. -                    // discard console events that are not "key down", because-                    // these will also be discarded by ReadFile().-                    if (buf[0].EventType == KEY_EVENT &&-                        buf[0].Event.KeyEvent.bKeyDown &&-                        buf[0].Event.KeyEvent.uChar.AsciiChar != '\0')-                    {-                        // it's a proper keypress:-                        return 1;-                    }-                    else+                    while (1) // keep trying until we find a real key event                     {-                        // it's a non-key event, a key up event, or a-                        // non-character key (e.g. shift).  discard it.-                        rc = ReadConsoleInput(hFile, buf, 1, &count);-                        if (rc == 0) {-                            rc = GetLastError();-                            if (rc == ERROR_INVALID_HANDLE || rc == ERROR_INVALID_FUNCTION) {+                        rc = WaitForSingleObject(+                            hFile,+                            compute_WaitForSingleObject_timeout(infinite, remaining));+                        switch (rc) {+                            case WAIT_TIMEOUT:+                                // We need to use < here because if remaining+                                // was INFINITE, we'll have waited for+                                // `INFINITE - 1` as per+                                // compute_WaitForSingleObject_timeout(),+                                // so that's 1 ms too little. Wait again then.+                                if (!infinite && remaining < MSToTime(INFINITE))+                                    return 0;+                                goto waitAgain;+                            case WAIT_OBJECT_0: break;+                            default: /* WAIT_FAILED */ maperrno(); return -1;+                        }++                        while (1) // discard non-key events+                        {+                            BOOL success = PeekConsoleInput(hFile, buf, 1, &count);+                            // printf("peek, rc=%d, count=%d, type=%d\n", rc, count, buf[0].EventType);+                            if (!success) {+                                rc = GetLastError();+                                if (rc == ERROR_INVALID_HANDLE || rc == ERROR_INVALID_FUNCTION) {+                                    return 1;+                                } else {+                                    maperrno();+                                    return -1;+                                }+                            }++                            if (count == 0) break; // no more events => wait again++                            // discard console events that are not "key down", because+                            // these will also be discarded by ReadFile().+                            if (buf[0].EventType == KEY_EVENT &&+                                buf[0].Event.KeyEvent.bKeyDown &&+                                buf[0].Event.KeyEvent.uChar.AsciiChar != '\0')+                            {+                                // it's a proper keypress:                                 return 1;-                            } else {-                                maperrno();-                                return -1;                             }+                            else+                            {+                                // it's a non-key event, a key up event, or a+                                // non-character key (e.g. shift).  discard it.+                                BOOL success = ReadConsoleInput(hFile, buf, 1, &count);+                                if (!success) {+                                    rc = GetLastError();+                                    if (rc == ERROR_INVALID_HANDLE || rc == ERROR_INVALID_FUNCTION) {+                                        return 1;+                                    } else {+                                        maperrno();+                                        return -1;+                                    }+                                }+                            }                         }++                        Time now;+                    waitAgain:+                        now = getProcessElapsedTime();+                        remaining = endTime - now;                     }                 }-            }-        } -        case FILE_TYPE_DISK:-            // assume that disk files are always ready:-            return 1;+            case FILE_TYPE_DISK:+                // assume that disk files are always ready:+                return 1; -        case FILE_TYPE_PIPE:-            // WaitForMultipleObjects() doesn't work for pipes (it-            // always returns WAIT_OBJECT_0 even when no data is-            // available).  If the HANDLE is a pipe, therefore, we try-            // PeekNamedPipe:-            //-            rc = PeekNamedPipe( hFile, NULL, 0, NULL, &avail, NULL );-            if (rc != 0) {-                if (avail != 0) {-                    return 1;-                } else {-                    return 0;-                }-            } else {-                rc = GetLastError();-                if (rc == ERROR_BROKEN_PIPE) {-                    return 1; // this is probably what we want-                }-                if (rc != ERROR_INVALID_HANDLE && rc != ERROR_INVALID_FUNCTION) {-                    maperrno();-                    return -1;+            case FILE_TYPE_PIPE: {+                // WaitForMultipleObjects() doesn't work for pipes (it+                // always returns WAIT_OBJECT_0 even when no data is+                // available).  If the HANDLE is a pipe, therefore, we try+                // PeekNamedPipe():+                //+                // PeekNamedPipe() does not block, so if it returns that+                // there is no new data, we have to sleep and try again.+                while (avail == 0) {+                    BOOL success = PeekNamedPipe( hFile, NULL, 0, NULL, &avail, NULL );+                    if (success) {+                        if (avail != 0) {+                            return 1;+                        } else { // no new data+                            if (infinite) {+                                Sleep(1); // 1 millisecond (smallest possible time on Windows)+                                continue;+                            } else if (msecs == 0) {+                                return 0;+                            } else {+                                Time now = getProcessElapsedTime();+                                if (now >= endTime) return 0;+                                Sleep(1); // 1 millisecond (smallest possible time on Windows)+                                continue;+                            }+                        }+                    } else {+                        rc = GetLastError();+                        if (rc == ERROR_BROKEN_PIPE) {+                            return 1; // this is probably what we want+                        }+                        if (rc != ERROR_INVALID_HANDLE && rc != ERROR_INVALID_FUNCTION) {+                            maperrno();+                            return -1;+                        }+                    }                 }             }             /* PeekNamedPipe didn't work - fall through to the general case */ -        default:-            rc = WaitForSingleObject( hFile, msecs );+            default:+                while (true) {+                    rc = WaitForSingleObject(+                        hFile,+                        compute_WaitForSingleObject_timeout(infinite, remaining)); -            /* 1 => Input ready, 0 => not ready, -1 => error */-            switch (rc) {-            case WAIT_TIMEOUT: return 0;-            case WAIT_OBJECT_0: return 1;-            default: /* WAIT_FAILED */ maperrno(); return -1;-            }+                    switch (rc) {+                        case WAIT_TIMEOUT:+                            // We need to use < here because if remaining+                            // was INFINITE, we'll have waited for+                            // `INFINITE - 1` as per+                            // compute_WaitForSingleObject_timeout(),+                            // so that's 1 ms too little. Wait again then.+                            if (!infinite && remaining < MSToTime(INFINITE))+                                return 0;+                            break;+                        case WAIT_OBJECT_0: return 1;+                        default: /* WAIT_FAILED */ maperrno(); return -1;+                    }++                    // EINTR or a >(INFINITE - 1) timeout completed+                    if (!infinite) {+                        Time now = getProcessElapsedTime();+                        if (now >= endTime) return 0;+                        remaining = endTime - now;+                    }+                }         }     } #endif-}    +}
cbits/primFloat.c view
@@ -109,7 +109,7 @@  */  /* In case you don't support IEEE, you'll just get dummy defs.. */-#ifdef IEEE_FLOATING_POINT+#if defined(IEEE_FLOATING_POINT)  HsInt isDoubleFinite(HsDouble d)@@ -315,7 +315,7 @@         mant += 2*half;         if (mant == FLT_POWER2)         {-            /* next power of 2, increase exponent an set mantissa to 0 */+            /* next power of 2, increase exponent and set mantissa to 0 */             u.ieee.mantissa = 0;             u.ieee.exponent += 1;             return u.f;
changelog.md view
@@ -1,5 +1,84 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) ++## 4.11.0.0 *TBA*+  * Bundled with GHC 8.4.1++  * `System.IO.openTempFile` is now thread-safe on Windows.++  * Deprecated `GHC.Stats.GCStats` interface has been removed.++  * Add `showHFloat` to `Numeric`++  * Add `Div`, `Mod`, and `Log2` functions on type-level naturals+    in `GHC.TypeLits`.++  * Add `Alternative` instance for `ZipList` (#13520)++  * Add instances `Num`, `Functor`, `Applicative`, `Monad`, `Semigroup`+    and `Monoid` for `Data.Ord.Down` (#13097).++  * Add `Semigroup` instance for `EventLifetime`.++  * Make `Semigroup` a superclass of `Monoid`;+    export `Semigroup((<>))` from `Prelude`; remove `Monoid` reexport+    from `Data.Semigroup` (#14191).++  * Generalise `instance Monoid a => Monoid (Maybe a)` to+    `instance Semigroup a => Monoid (Maybe a)`.++  * Add `infixl 9 !!` declaration for `Data.List.NonEmpty.!!`++  * Add `<&>` operator to `Data.Functor` (#14029)++  * Remove the deprecated `Typeable{1..7}` type synonyms (#14047)++  * Make `Data.Type.Equality.==` a closed type family. It now works for all+  kinds out of the box. Any modules that previously declared instances of this+  family will need to remove them. Whereas the previous definition was somewhat+  ad hoc, the behavior is now completely uniform. As a result, some applications+  that used to reduce no longer do, and conversely. Most notably, `(==)` no+  longer treats the `*`, `j -> k`, or `()` kinds specially; equality is+  tested structurally in all cases.++  * Add instances `Semigroup` and `Monoid` for `Control.Monad.ST` (#14107).++  * The `Read` instances for `Proxy`, `Coercion`, `(:~:)`, `(:~~:)`, and `U1`+    now ignore the parsing precedence. The effect of this is that `read` will+    be able to successfully parse more strings containing `"Proxy"` _et al._+    without surrounding parentheses (e.g., `"Thing Proxy"`) (#12874).++  * Add `iterate'`, a strict version of `iterate`, to `Data.List`+    and `Data.OldList` (#3474)++  * Add `Data` instances for `IntPtr` and `WordPtr` (#13115)++  * Add missing `MonadFail` instance for `Control.Monad.Strict.ST.ST`++  * Make `zipWith` and `zipWith3` inlinable (#14224)++  * `Type.Reflection.App` now matches on function types (fixes #14236)++  * `Type.Reflection.withTypeable` is now polymorphic in the `RuntimeRep` of+    its result.++  * Add `installSEHHandlers` to `MiscFlags` in `GHC.RTS.Flags` to determine if+    exception handling is enabled.++  * The deprecated functions `isEmptyChan` and `unGetChan` in+    `Control.Concurrent.Chan` have been removed (#13561).++  * Add `generateCrashDumpFile` to `MiscFlags` in `GHC.RTS.Flags` to determine+    if a core dump will be generated on crashes.++  * Add `generateStackTrace` to `MiscFlags` in `GHC.RTS.Flags` to determine if+    stack traces will be generated on unhandled exceptions by the RTS.++  * `getExecutablePath` now resolves symlinks on Windows (#14483)++  * Deprecated STM invariant checking primitives (`checkInv`, `always`, and+    `alwaysSucceeds`) in `GHC.Conc.Sync` (#14324).+ ## 4.10.1.0 *November 2017*   * Bundled with GHC 8.2.2 
configure view
@@ -4385,7 +4385,7 @@  fi -# Linux open file description locks+# Linux open file descriptor locks ac_fn_c_check_decl "$LINENO" "F_OFD_SETLK" "ac_cv_have_decl_F_OFD_SETLK" "$ac_includes_default" if test "x$ac_cv_have_decl_F_OFD_SETLK" = xyes; then : @@ -28443,11 +28443,13 @@ fi  # Hack - md5.h needs HsFFI.h.  Is there a better way to do this?-CFLAGS="-I../../includes $CFLAGS"+CFLAGS="-I../.. -I../../../../includes $CFLAGS" ac_fn_c_check_type "$LINENO" "struct MD5Context" "ac_cv_type_struct_MD5Context" "#include \"include/md5.h\" " if test "x$ac_cv_type_struct_MD5Context" = xyes; then : +else+  as_fn_error $? "internal error" "$LINENO" 5 fi  # The cast to long int works around a bug in the HP C Compiler
configure.ac view
@@ -69,7 +69,7 @@   AC_DEFINE([HAVE_POLL], [1], [Define if you have poll support.]) fi -# Linux open file description locks+# Linux open file descriptor locks AC_CHECK_DECL([F_OFD_SETLK], [   AC_DEFINE([HAVE_OFD_LOCKING], [1], [Define if you have open file descriptor lock support.]) ])@@ -234,10 +234,10 @@ fi  # Hack - md5.h needs HsFFI.h.  Is there a better way to do this?-CFLAGS="-I../../includes $CFLAGS"+CFLAGS="-I../.. -I../../../../includes $CFLAGS" dnl Calling AC_CHECK_TYPE(T) makes AC_CHECK_SIZEOF(T) abort on failure dnl instead of considering sizeof(T) as 0.-AC_CHECK_TYPE([struct MD5Context], [], [], [#include "include/md5.h"])+AC_CHECK_TYPE([struct MD5Context], [], [AC_MSG_ERROR([internal error])], [#include "include/md5.h"]) AC_CHECK_SIZEOF([struct MD5Context], [], [#include "include/md5.h"])  AC_SUBST(EXTRA_LIBS)
include/CTypes.h view
@@ -5,8 +5,7 @@ // -------------------------------------------------------------------------- -} -#ifndef CTYPES__H-#define CTYPES__H+#pragma once  {- // As long as there is no automatic derivation of classes for newtypes we resort@@ -47,5 +46,3 @@ newtype {-# CTYPE "THE_CTYPE" #-} T = T (B) \     deriving (OPAQUE_CLASSES) \     deriving newtype Show;--#endif
include/HsBase.h view
@@ -6,8 +6,7 @@  *  * ---------------------------------------------------------------------------*/ -#ifndef __HSBASE_H__-#define __HSBASE_H__+#pragma once  #include "HsBaseConfig.h" @@ -100,8 +99,8 @@ #elif HAVE_STDINT_H # include <stdint.h> #endif-#if HAVE_CLOCK_GETTIME-# ifdef _POSIX_MONOTONIC_CLOCK+#if defined(HAVE_CLOCK_GETTIME)+# if defined(_POSIX_MONOTONIC_CLOCK) #  define CLOCK_ID CLOCK_MONOTONIC # else #  define CLOCK_ID CLOCK_REALTIME@@ -153,7 +152,7 @@ #endif  /* in inputReady.c */-extern int fdReady(int fd, int write, int msecs, int isSock);+extern int fdReady(int fd, int write, int64_t msecs, int isSock);  /* -----------------------------------------------------------------------------    INLINE functions.@@ -163,7 +162,7 @@    when compiling to native code.    -------------------------------------------------------------------------- */ -#ifndef INLINE+#if !defined(INLINE) # if defined(_MSC_VER) #  define INLINE extern __inline # else@@ -193,7 +192,7 @@ INLINE int __hscore_o_rdonly(void) {-#ifdef O_RDONLY+#if defined(O_RDONLY)   return O_RDONLY; #else   return 0;@@ -203,7 +202,7 @@ INLINE int __hscore_o_wronly( void ) {-#ifdef O_WRONLY+#if defined(O_WRONLY)   return O_WRONLY; #else   return 0;@@ -213,7 +212,7 @@ INLINE int __hscore_o_rdwr( void ) {-#ifdef O_RDWR+#if defined(O_RDWR)   return O_RDWR; #else   return 0;@@ -223,7 +222,7 @@ INLINE int __hscore_o_append( void ) {-#ifdef O_APPEND+#if defined(O_APPEND)   return O_APPEND; #else   return 0;@@ -233,7 +232,7 @@ INLINE int __hscore_o_creat( void ) {-#ifdef O_CREAT+#if defined(O_CREAT)   return O_CREAT; #else   return 0;@@ -243,7 +242,7 @@ INLINE int __hscore_o_excl( void ) {-#ifdef O_EXCL+#if defined(O_EXCL)   return O_EXCL; #else   return 0;@@ -253,7 +252,7 @@ INLINE int __hscore_o_trunc( void ) {-#ifdef O_TRUNC+#if defined(O_TRUNC)   return O_TRUNC; #else   return 0;@@ -263,7 +262,7 @@ INLINE int __hscore_o_noctty( void ) {-#ifdef O_NOCTTY+#if defined(O_NOCTTY)   return O_NOCTTY; #else   return 0;@@ -273,7 +272,7 @@ INLINE int __hscore_o_nonblock( void ) {-#ifdef O_NONBLOCK+#if defined(O_NONBLOCK)   return O_NONBLOCK; #else   return 0;@@ -375,7 +374,7 @@ INLINE HsInt __hscore_sizeof_termios( void ) {-#ifndef _WIN32+#if !defined(_WIN32)   return sizeof(struct termios); #else   return 0;@@ -394,7 +393,7 @@ INLINE int __hscore_echo( void ) {-#ifdef ECHO+#if defined(ECHO)   return ECHO; #else   return 0;@@ -405,7 +404,7 @@ INLINE int __hscore_tcsanow( void ) {-#ifdef TCSANOW+#if defined(TCSANOW)   return TCSANOW; #else   return 0;@@ -416,7 +415,7 @@ INLINE int __hscore_icanon( void ) {-#ifdef ICANON+#if defined(ICANON)   return ICANON; #else   return 0;@@ -425,7 +424,7 @@  INLINE int __hscore_vmin( void ) {-#ifdef VMIN+#if defined(VMIN)   return VMIN; #else   return 0;@@ -434,7 +433,7 @@  INLINE int __hscore_vtime( void ) {-#ifdef VTIME+#if defined(VTIME)   return VTIME; #else   return 0;@@ -443,7 +442,7 @@  INLINE int __hscore_sigttou( void ) {-#ifdef SIGTTOU+#if defined(SIGTTOU)   return SIGTTOU; #else   return 0;@@ -452,7 +451,7 @@  INLINE int __hscore_sig_block( void ) {-#ifdef SIG_BLOCK+#if defined(SIG_BLOCK)   return SIG_BLOCK; #else   return 0;@@ -461,14 +460,14 @@  INLINE int __hscore_sig_setmask( void ) {-#ifdef SIG_SETMASK+#if defined(SIG_SETMASK)   return SIG_SETMASK; #else   return 0; #endif } -#ifndef _WIN32+#if !defined(_WIN32) INLINE size_t __hscore_sizeof_siginfo_t (void) {     return sizeof(siginfo_t);@@ -478,7 +477,7 @@ INLINE int __hscore_f_getfl( void ) {-#ifdef F_GETFL+#if defined(F_GETFL)   return F_GETFL; #else   return 0;@@ -488,7 +487,7 @@ INLINE int __hscore_f_setfl( void ) {-#ifdef F_SETFL+#if defined(F_SETFL)   return F_SETFL; #else   return 0;@@ -498,7 +497,7 @@ INLINE int __hscore_f_setfd( void ) {-#ifdef F_SETFD+#if defined(F_SETFD)   return F_SETFD; #else   return 0;@@ -508,7 +507,7 @@ INLINE long __hscore_fd_cloexec( void ) {-#ifdef FD_CLOEXEC+#if defined(FD_CLOEXEC)   return FD_CLOEXEC; #else   return 0;@@ -519,7 +518,7 @@ extern void* __hscore_get_saved_termios(int fd); extern void __hscore_set_saved_termios(int fd, void* ts); -#ifdef _WIN32+#if defined(_WIN32) INLINE int __hscore_open(wchar_t *file, int how, mode_t mode) { 	if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND)) 	  return _wsopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode);@@ -554,6 +553,3 @@  void errorBelch2(const char*s, char *t); void debugBelch2(const char*s, char *t);--#endif /* __HSBASE_H__ */-
include/WCsubst.h view
@@ -1,6 +1,4 @@-#ifndef WCSUBST_INCL--#define WCSUBST_INCL+#pragma once  #include "HsFFI.h" #include <stdlib.h>@@ -20,6 +18,3 @@ HsInt u_towtitle(HsInt wc);  HsInt u_gencat(HsInt wc);--#endif-
include/consUtils.h view
@@ -3,11 +3,10 @@  *  * Win32 Console API helpers.  */-#ifndef __CONSUTILS_H__-#define __CONSUTILS_H__+#pragma once+ extern int is_console__(int fd); extern int set_console_buffering__(int fd, int cooked); extern int set_console_echo__(int fd, int on); extern int get_console_echo__(int fd); extern int flush_input_console__ (int fd);-#endif
include/ieee-flpt.h view
@@ -4,32 +4,32 @@ #define IEEE_FLOATING_POINT 1     /* Radix of exponent representation */-#ifndef FLT_RADIX+#if !defined(FLT_RADIX) # define FLT_RADIX 2 #endif     /* Number of base-FLT_RADIX digits in the significand of a float */-#ifndef FLT_MANT_DIG+#if !defined(FLT_MANT_DIG) # define FLT_MANT_DIG 24 #endif    /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */-#ifndef FLT_MIN_EXP+#if !defined(FLT_MIN_EXP) #  define FLT_MIN_EXP (-125) #endif    /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */-#ifndef FLT_MAX_EXP+#if !defined(FLT_MAX_EXP) # define FLT_MAX_EXP 128 #endif     /* Number of base-FLT_RADIX digits in the significand of a double */-#ifndef DBL_MANT_DIG+#if !defined(DBL_MANT_DIG) # define DBL_MANT_DIG 53 #endif    /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */-#ifndef DBL_MIN_EXP+#if !defined(DBL_MIN_EXP) #  define DBL_MIN_EXP (-1021) #endif    /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */-#ifndef DBL_MAX_EXP+#if !defined(DBL_MAX_EXP) # define DBL_MAX_EXP 1024 #endif
include/md5.h view
@@ -1,6 +1,5 @@ /* MD5 message digest */-#ifndef _MD5_H-#define _MD5_H+#pragma once  #include "HsFFI.h" @@ -17,8 +16,3 @@ void __hsbase_MD5Update(struct MD5Context *context, byte const *buf, int len); void __hsbase_MD5Final(byte digest[16], struct MD5Context *context); void __hsbase_MD5Transform(word32 buf[4], word32 const in[16]);--#endif /* _MD5_H */---