From 8f0f67ad1a2d4da9e1ffef63c811a70bf44934a7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 17 Sep 2024 21:52:44 +0000 Subject: [PATCH] [ docs ] CI docs generation https://github.com/stefan-hoeck/idris2-pack-db/actions/runs/10911153148 --- .../docs/Deriving.DepTyCheck.Gen.Checked.html | 2 +- ...ng.DepTyCheck.Gen.Core.ConsDerive.src.html | 374 +++-- ...ing.DepTyCheck.Gen.Core.ConsEntry.src.html | 198 ++- .../Deriving.DepTyCheck.Gen.Core.Util.html | 2 +- .../docs/Deriving.DepTyCheck.Gen.Derive.html | 2 +- .../Deriving.DepTyCheck.Gen.Entry.src.html | 510 ++++--- .../Deriving.DepTyCheck.Util.Logging.html | 2 +- .../Deriving.DepTyCheck.Util.Reflection.html | 2 +- ...riving.DepTyCheck.Util.Reflection.src.html | 677 ++++----- .../docs/docs/Language.Reflection.Compat.html | 2 +- .../docs/Test.DepTyCheck.Gen.Coverage.html | 2 +- .../docs/Test.DepTyCheck.Gen.Emptiness.html | 2 +- .../docs/docs/Test.DepTyCheck.Gen.Labels.html | 2 +- .../docs/docs/Test.DepTyCheck.Gen.html | 2 +- .../docs/docs/System.Linux.Inotify.Flags.html | 2 +- .../linux/docs/docs/System.Linux.Inotify.html | 2 +- .../docs/docs/System.Linux.Inotify.src.html | 61 +- docs/linux/docs/docs/System.Linux.Pipe.html | 64 + .../docs/docs/System.Linux.Pipe.src.html | 158 +++ .../docs/docs/System.Linux.Pthreads.html | 64 + .../docs/docs/System.Linux.Pthreads.src.html | 142 ++ .../docs/System.Linux.Signalfd.Flags.html | 2 +- .../docs/docs/System.Linux.Signalfd.html | 2 +- .../docs/docs/System.Linux.Signalfd.src.html | 25 +- .../docs/docs/System.Linux.Timerfd.Flags.html | 2 +- .../linux/docs/docs/System.Linux.Timerfd.html | 2 +- .../docs/docs/System.Linux.Timerfd.src.html | 21 +- .../docs/docs/System.Linux.User.Passwd.html | 2 +- docs/linux/docs/index.html | 18 + docs/posix/docs/docs/System.Posix.Dir.html | 2 +- .../posix/docs/docs/System.Posix.Dir.src.html | 55 +- .../docs/docs/System.Posix.Errno.Type.html | 2 +- .../docs/System.Posix.Errno.Type.src.html | 1208 +++++++++++------ docs/posix/docs/docs/System.Posix.Errno.html | 2 +- .../docs/docs/System.Posix.Errno.src.html | 121 +- .../docs/docs/System.Posix.File.Flags.html | 2 +- .../docs/System.Posix.File.Flags.src.html | 2 +- .../docs/docs/System.Posix.File.Stats.html | 2 +- .../docs/System.Posix.File.Stats.src.html | 10 +- .../docs/docs/System.Posix.File.Type.html | 2 +- .../docs/docs/System.Posix.File.Whence.html | 2 +- docs/posix/docs/docs/System.Posix.File.html | 2 +- .../docs/docs/System.Posix.File.src.html | 701 +++++----- docs/posix/docs/docs/System.Posix.Pipe.html | 64 + .../docs/docs/System.Posix.Pipe.src.html | 154 +++ .../docs/docs/System.Posix.Process.Flags.html | 2 +- .../posix/docs/docs/System.Posix.Process.html | 2 +- .../docs/docs/System.Posix.Process.src.html | 249 ++-- .../docs/System.Posix.Pthreads.Types.html | 2 +- .../docs/docs/System.Posix.Pthreads.html | 2 +- .../docs/docs/System.Posix.Pthreads.src.html | 573 ++++---- .../docs/docs/System.Posix.Signal.Types.html | 2 +- docs/posix/docs/docs/System.Posix.Signal.html | 2 +- .../docs/docs/System.Posix.Signal.src.html | 439 +++--- docs/posix/docs/docs/System.Posix.Time.html | 2 +- .../docs/docs/System.Posix.Timer.Types.html | 2 +- docs/posix/docs/docs/System.Posix.Timer.html | 2 +- .../docs/docs/System.Posix.Timer.src.html | 33 +- docs/posix/docs/index.html | 9 + 59 files changed, 3522 insertions(+), 2476 deletions(-) create mode 100644 docs/linux/docs/docs/System.Linux.Pipe.html create mode 100644 docs/linux/docs/docs/System.Linux.Pipe.src.html create mode 100644 docs/linux/docs/docs/System.Linux.Pthreads.html create mode 100644 docs/linux/docs/docs/System.Linux.Pthreads.src.html create mode 100644 docs/posix/docs/docs/System.Posix.Pipe.html create mode 100644 docs/posix/docs/docs/System.Posix.Pipe.src.html diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Checked.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Checked.html index d5e6bde27..90098275b 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Checked.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Checked.html @@ -62,4 +62,4 @@

Deriving.DepTyCheck.Gen.Checked

(source)
A bridge between a single act of derivation and a user derivation task
-

Reexports

importpublic Control.Monad.Either
importpublic Control.Monad.Reader
importpublic Control.Monad.State
importpublic Control.Monad.State.Tuple
importpublic Control.Monad.Writer
importpublic Control.Monad.RWS
importpublic Data.DPair
importpublic Data.SortedMap
importpublic Data.SortedMap.Extra
importpublic Data.SortedSet
importpublic Decidable.Equality
importpublic Deriving.DepTyCheck.Gen.Derive
importpublic Deriving.DepTyCheck.Util.Reflection

Definitions

dataArgExplicitness : Type
Totality: total
Visibility: public export
Constructors:
ExplicitArg : ArgExplicitness
ImplicitArg : ArgExplicitness

Hint: 
EqArgExplicitness
.toTT : ArgExplicitness->PiInfoa
Totality: total
Visibility: public export
recordExternalGenSignature : Type
Totality: total
Visibility: public export
Constructor: 
MkExternalGenSignature : (targetType : TypeInfo) -> {auto0_ : AllTyArgsNamedtargetType} ->SortedMap (Fin ((targetType.args) .length)) (ArgExplicitness, Name) ->ExternalGenSignature

Projections:
.givenParams : ({rec:0} : ExternalGenSignature) ->SortedMap (Fin (((targetType{rec:0}) .args) .length)) (ArgExplicitness, Name)
.targetType : ExternalGenSignature->TypeInfo
0.targetTypeCorrect : ({rec:0} : ExternalGenSignature) ->AllTyArgsNamed (targetType{rec:0})

Hints:
EqExternalGenSignature
OrdExternalGenSignature
.targetType : ExternalGenSignature->TypeInfo
Totality: total
Visibility: public export
targetType : ExternalGenSignature->TypeInfo
Totality: total
Visibility: public export
0.targetTypeCorrect : ({rec:0} : ExternalGenSignature) ->AllTyArgsNamed (targetType{rec:0})
Totality: total
Visibility: public export
0targetTypeCorrect : ({rec:0} : ExternalGenSignature) ->AllTyArgsNamed (targetType{rec:0})
Totality: total
Visibility: public export
.givenParams : ({rec:0} : ExternalGenSignature) ->SortedMap (Fin (((targetType{rec:0}) .args) .length)) (ArgExplicitness, Name)
Totality: total
Visibility: public export
givenParams : ({rec:0} : ExternalGenSignature) ->SortedMap (Fin (((targetType{rec:0}) .args) .length)) (ArgExplicitness, Name)
Totality: total
Visibility: public export
characteristics : ExternalGenSignature-> (String, ListNat)
Totality: total
Visibility: export
internalise : (extSig : ExternalGenSignature) ->SubsetGenSignature (\sig=> (sig.givenParams) .size= (extSig.givenParams) .size)
Totality: total
Visibility: export
runCanonic : DerivatorCore=>NamesInfoInTypes=>SortedMapExternalGenSignatureName-> (CanonicGenm=>ma) ->Elab (a, ListDecl)
Totality: total
Visibility: export
+

Reexports

importpublic Control.Monad.Either
importpublic Control.Monad.Reader
importpublic Control.Monad.State
importpublic Control.Monad.State.Tuple
importpublic Control.Monad.Writer
importpublic Control.Monad.RWS
importpublic Data.DPair
importpublic Data.SortedMap
importpublic Data.SortedMap.Extra
importpublic Data.SortedSet
importpublic Decidable.Equality
importpublic Deriving.DepTyCheck.Gen.Derive
importpublic Deriving.DepTyCheck.Util.Reflection

Definitions

dataArgExplicitness : Type
Totality: total
Visibility: public export
Constructors:
ExplicitArg : ArgExplicitness
ImplicitArg : ArgExplicitness

Hint: 
EqArgExplicitness
.toTT : ArgExplicitness->PiInfoa
Totality: total
Visibility: public export
recordExternalGenSignature : Type
Totality: total
Visibility: public export
Constructor: 
MkExternalGenSignature : (targetType : TypeInfo) -> {auto0_ : AllTyArgsNamedtargetType} ->SortedMap (Fin ((targetType.args) .length)) (ArgExplicitness, Name) ->ExternalGenSignature

Projections:
.givenParams : ({rec:0} : ExternalGenSignature) ->SortedMap (Fin (((targetType{rec:0}) .args) .length)) (ArgExplicitness, Name)
.targetType : ExternalGenSignature->TypeInfo
0.targetTypeCorrect : ({rec:0} : ExternalGenSignature) ->AllTyArgsNamed (targetType{rec:0})

Hints:
EqExternalGenSignature
OrdExternalGenSignature
.targetType : ExternalGenSignature->TypeInfo
Totality: total
Visibility: public export
targetType : ExternalGenSignature->TypeInfo
Totality: total
Visibility: public export
0.targetTypeCorrect : ({rec:0} : ExternalGenSignature) ->AllTyArgsNamed (targetType{rec:0})
Totality: total
Visibility: public export
0targetTypeCorrect : ({rec:0} : ExternalGenSignature) ->AllTyArgsNamed (targetType{rec:0})
Totality: total
Visibility: public export
.givenParams : ({rec:0} : ExternalGenSignature) ->SortedMap (Fin (((targetType{rec:0}) .args) .length)) (ArgExplicitness, Name)
Totality: total
Visibility: public export
givenParams : ({rec:0} : ExternalGenSignature) ->SortedMap (Fin (((targetType{rec:0}) .args) .length)) (ArgExplicitness, Name)
Totality: total
Visibility: public export
characteristics : ExternalGenSignature-> (String, ListNat)
Totality: total
Visibility: export
internalise : (extSig : ExternalGenSignature) ->SubsetGenSignature (\sig=> (sig.givenParams) .size= (extSig.givenParams) .size)
Totality: total
Visibility: export
runCanonic : DerivatorCore=>NamesInfoInTypes=>SortedMapExternalGenSignatureName-> (CanonicGenm=>ma) ->Elab (a, ListDecl)
Totality: total
Visibility: export
diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.ConsDerive.src.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.ConsDerive.src.html index 7ac46992c..52b81d8bc 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.ConsDerive.src.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.ConsDerive.src.html @@ -204,202 +204,196 @@
 83 |       -- Compute left-to-right need of generation when there are non-trivial types at the left
 84 |       argsTypeApps <- for con.args.asVect $ analyseTypeApp . type
 85 |
-
 86 |       -- Decide how constructor arguments would be named during generation
-
 87 |       let bindNames : Vect (con.args.length) String
-
 88 |           bindNames = flip mapI .| fromList con.args .| \_ => bindNameRenamer . argName
-
 89 |
-
 90 |       -- Derive constructor calling expression for given order of generation
-
 91 |       let genForOrder : List (Fin con.args.length) -> m TTImp
-
 92 |           genForOrder order = foldr apply callCons <$> evalStateT givs (for order genForOneArg) where
+
 86 |       -- Get dependencies of constructor's arguments
+
 87 |       let rawDeps' = argDeps con.args
+
 88 |       let rawDeps : Vect _ $ SortedSet $ Fin con.args.length := downmap (mapIn weakenToSuper) rawDeps'
+
 89 |       let dependees = concat rawDeps -- arguments which any other argument depends on
+
 90 |
+
 91 |       -- Decide how constructor arguments would be named during generation
+
 92 |       let bindNames = withIndex (fromList con.args) <&> map (bindNameRenamer . argName)
 93 |
-
 94 |             -- ... state is the set of arguments that are already present (given or generated)
-
 95 |             genForOneArg : forall m.
-
 96 |                            CanonicGen m =>
-
 97 |                            MonadState (SortedSet $ Fin con.args.length) m =>
-
 98 |                            (gened : Fin con.args.length) -> m $ TTImp -> TTImp
-
 99 |             genForOneArg genedArg = do
-
100 |
-
101 |               -- Get info for the `genedArg`
-
102 |               let MkTypeApp typeOfGened argsOfTypeOfGened = index genedArg $ the (Vect _ TypeApp) argsTypeApps
-
103 |
-
104 |               -- Acquire the set of arguments that are already present
-
105 |               presentArguments <- get
-
106 |
-
107 |               -- TODO to put the following check as up as possible as soon as it typecheks O_O
-
108 |               -- Check that those argument that we need to generate is not already present
-
109 |               let False = contains genedArg presentArguments
-
110 |                 | True => pure id
-
111 |
-
112 |               -- Filter arguments classification according to the set of arguments that are left to be generated;
-
113 |               -- Those which are `Right` are given, those which are `Left` are needs to be generated.
-
114 |               let depArgs : Vect typeOfGened.args.length (Either (Fin con.args.length) TTImp) := argsOfTypeOfGened <&> \case
-
115 |                 Right expr => Right expr
-
116 |                 Left i     => if contains i presentArguments then Right $ var $ argName $ index' con.args i else Left i
-
117 |
-
118 |               -- Determine which arguments will be on the left of dpair in subgen call, in correct order
-
119 |               let subgeneratedArgs = mapMaybe getLeft $ toList depArgs
-
120 |
-
121 |               -- Make sure generated arguments will not be generated again
-
122 |               modify $ insert genedArg . union (fromList subgeneratedArgs)
-
123 |
-
124 |               -- Form a task for subgen
-
125 |               let (subgivensLength ** subgivens= mapMaybe (\(ie, idx) => (idx,) <$> getRight ie) $ depArgs `zip` Fin.range
-
126 |               let subsig : GenSignature := MkGenSignature typeOfGened $ fromList $ fst <$> toList subgivens
-
127 |               let Yes Refl = decEq subsig.givenParams.size subgivensLength
-
128 |                 | No _ => fail "INTERNAL ERROR: error in given params set length computation"
-
129 |
-
130 |               -- Check if called subgenerator can call the current one
-
131 |               let mutRec = hasNameInsideDeep sig.targetType.name $ var subsig.targetType.name
-
132 |
-
133 |               -- Decide whether to use local (decreasing) or outmost fuel, depending on whether we are in mutual recursion with subgen
-
134 |               let subfuel = if mutRec then fuel else var outmostFuelArg
-
135 |
-
136 |               -- Form an expression to call the subgen
-
137 |               subgenCall <- callGen subsig subfuel $ snd <$> subgivens
-
138 |
-
139 |               -- Form an expression of binding the result of subgen
-
140 |               let genedArg:::subgeneratedArgs = genedArg:::subgeneratedArgs <&> bindVar . flip Vect.index bindNames
-
141 |               let bindSubgenResult = foldr (\l, r => var `{Builtin.DPair.MkDPair} .$ l .$ r) genedArg subgeneratedArgs
+
 94 |       -- Form the expression of calling the current constructor
+
 95 |       let callCons = do
+
 96 |         let constructorCall = callCon con $ bindNames <&> \(idx, n) => if contains idx dependees then implicitTrue else varStr n
+
 97 |         let wrapImpls : Nat -> TTImp
+
 98 |             wrapImpls Z     = constructorCall
+
 99 |             wrapImpls (S n) = var `{Builtin.DPair.MkDPair} .$ implicitTrue .$ wrapImpls n
+
100 |         let consExpr = wrapImpls $ sig.targetType.args.length `minus` sig.givenParams.size
+
101 |         `(Prelude.pure {f=Test.DepTyCheck.Gen.Gen _} ~consExpr)
+
102 |
+
103 |       -- Derive constructor calling expression for given order of generation
+
104 |       let genForOrder : List (Fin con.args.length) -> m TTImp
+
105 |           -- ... state is the set of arguments that are already present (given or generated)
+
106 |           genForOrder order = map (foldr apply callCons) $ evalStateT givs $ for order $ \genedArg => do
+
107 |
+
108 |             -- Get info for the `genedArg`
+
109 |             let MkTypeApp typeOfGened argsOfTypeOfGened = index genedArg $ the (Vect _ TypeApp) argsTypeApps
+
110 |
+
111 |             -- Acquire the set of arguments that are already present
+
112 |             presentArguments <- get
+
113 |
+
114 |             -- TODO to put the following check as up as possible as soon as it typecheks O_O
+
115 |             -- Check that those argument that we need to generate is not already present
+
116 |             let False = contains genedArg presentArguments
+
117 |               | True => pure id
+
118 |
+
119 |             -- Filter arguments classification according to the set of arguments that are left to be generated;
+
120 |             -- Those which are `Right` are given, those which are `Left` are needs to be generated.
+
121 |             let depArgs : Vect typeOfGened.args.length (Either (Fin con.args.length) TTImp) := argsOfTypeOfGened <&> \case
+
122 |               Right expr => Right expr
+
123 |               Left i     => if contains i presentArguments then Right $ var $ argName $ index' con.args i else Left i
+
124 |
+
125 |             -- Determine which arguments will be on the left of dpair in subgen call, in correct order
+
126 |             let subgeneratedArgs = mapMaybe getLeft $ toList depArgs
+
127 |
+
128 |             -- Make sure generated arguments will not be generated again
+
129 |             modify $ insert genedArg . union (fromList subgeneratedArgs)
+
130 |
+
131 |             -- Form a task for subgen
+
132 |             let (subgivensLength ** subgivens= mapMaybe (\(ie, idx) => (idx,) <$> getRight ie) $ depArgs `zip` Fin.range
+
133 |             let subsig : GenSignature := MkGenSignature typeOfGened $ fromList $ fst <$> toList subgivens
+
134 |             let Yes Refl = decEq subsig.givenParams.size subgivensLength
+
135 |               | No _ => fail "INTERNAL ERROR: error in given params set length computation"
+
136 |
+
137 |             -- Check if called subgenerator can call the current one
+
138 |             let mutRec = hasNameInsideDeep sig.targetType.name $ var subsig.targetType.name
+
139 |
+
140 |             -- Decide whether to use local (decreasing) or outmost fuel, depending on whether we are in mutual recursion with subgen
+
141 |             let subfuel = if mutRec then fuel else var outmostFuelArg
142 |
-
143 |               -- Form an expression of the RHS of a bind; simplify lambda if subgeneration result type does not require pattern matching
-
144 |               let bindRHS = \cont => case bindSubgenResult of
-
145 |                                        IBindVar _ n => lam (MkArg MW ExplicitArg (Just $ UN $ Basic n) implicitFalse) cont
-
146 |                                        _            => `(\ ~bindSubgenResult => ~cont)
-
147 |
-
148 |               -- Chain the subgen call with a given continuation
-
149 |               pure $ \cont => `(~subgenCall >>= ~(bindRHS cont))
-
150 |
-
151 |             callCons : TTImp
-
152 |             callCons = do
-
153 |               let constructorCall = callCon con $ bindNames <&> varStr
-
154 |               let wrapImpls : Nat -> TTImp
-
155 |                   wrapImpls Z     = constructorCall
-
156 |                   wrapImpls (S n) = var `{Builtin.DPair.MkDPair} .$ implicitTrue .$ wrapImpls n
-
157 |               let consExpr = wrapImpls $ sig.targetType.args.length `minus` sig.givenParams.size
-
158 |               `(Prelude.pure {f=Test.DepTyCheck.Gen.Gen _} ~consExpr)
-
159 |
-
160 |       -- Get dependencies of constructor's arguments
-
161 |       rawDeps <- argDeps con.args
-
162 |       let deps = downmap ((`difference` givs) . mapIn weakenToSuper) rawDeps
-
163 |
-
164 |       -------------------------------------------------
-
165 |       -- Left-to-right generation phase (2nd phase) ---
-
166 |       -------------------------------------------------
-
167 |
-
168 |       -- Determine which arguments need to be generated in a left-to-right manner
-
169 |       let (leftToRightArgsTypeApp, leftToRightArgs) = unzip $ filter (\((MkTypeApp _ as)_) => any isRight as) $ toListI argsTypeApps
-
170 |
-
171 |       --------------------------------------------------------------------------------
-
172 |       -- Preparation of input for the left-to-right phase (1st right-to-left phase) --
-
173 |       --------------------------------------------------------------------------------
-
174 |
-
175 |       -- Acquire those variables that appear in non-trivial type expressions, i.e. those which needs to be generated before the left-to-right phase
-
176 |       let preLTR = leftToRightArgsTypeApp >>= \(MkTypeApp _ as) => rights (toList as) >>= allVarNames
-
177 |       let preLTR = SortedSet.fromList $ mapMaybe (lookup' conArgIdxs) preLTR
-
178 |
-
179 |       -- Find rightmost arguments among `preLTR`
-
180 |       let depsLTR = SortedSet.fromList $
-
181 |                       mapMaybe (\(ds, idx) => whenT .| contains idx preLTR && null ds .| idx) $
-
182 |                         toListI $ deps <&> intersection preLTR
-
183 |
-
184 |       ---------------------------------------------------------------------------------
-
185 |       -- Main right-to-left generation phase (3rd phase aka 2nd right-to-left phase) --
-
186 |       ---------------------------------------------------------------------------------
-
187 |
-
188 |       -- Arguments that no other argument depends on
-
189 |       let rightmostArgs = fromFoldable {f=Vect _} range `difference` (givs `union` concat deps)
-
190 |
-
191 |       ---------------------------------------------------------------
-
192 |       -- Manage different possible variants of generation ordering --
-
193 |       ---------------------------------------------------------------
-
194 |
-
195 |       -- Prepare info about which arguments are independent and thus can be ordered arbitrarily
-
196 |       let disjDeps = disjointDepSets rawDeps givs
+
143 |             -- Form an expression to call the subgen
+
144 |             subgenCall <- callGen subsig subfuel $ snd <$> subgivens
+
145 |
+
146 |             -- Form an expression of binding the result of subgen
+
147 |             let genedArg:::subgeneratedArgs = genedArg:::subgeneratedArgs <&> bindVar . snd . flip Vect.index bindNames
+
148 |             let bindSubgenResult = foldr (\l, r => var `{Builtin.DPair.MkDPair} .$ l .$ r) genedArg subgeneratedArgs
+
149 |
+
150 |             -- Form an expression of the RHS of a bind; simplify lambda if subgeneration result type does not require pattern matching
+
151 |             let bindRHS = \cont => case bindSubgenResult of
+
152 |                                      IBindVar _ n => lam (MkArg MW ExplicitArg (Just $ UN $ Basic n) implicitFalse) cont
+
153 |                                      _            => `(\ ~bindSubgenResult => ~cont)
+
154 |
+
155 |             -- Chain the subgen call with a given continuation
+
156 |             pure $ \cont => `(~subgenCall >>= ~(bindRHS cont))
+
157 |
+
158 |       -------------------------------------------------
+
159 |       -- Left-to-right generation phase (2nd phase) ---
+
160 |       -------------------------------------------------
+
161 |
+
162 |       -- Determine which arguments need to be generated in a left-to-right manner
+
163 |       let (leftToRightArgsTypeApp, leftToRightArgs) = unzip $ filter (\((MkTypeApp _ as)_) => any isRight as) $ toListI argsTypeApps
+
164 |
+
165 |       --------------------------------------------------------------------------------
+
166 |       -- Preparation of input for the left-to-right phase (1st right-to-left phase) --
+
167 |       --------------------------------------------------------------------------------
+
168 |
+
169 |       -- Acquire those variables that appear in non-trivial type expressions, i.e. those which needs to be generated before the left-to-right phase
+
170 |       let preLTR = leftToRightArgsTypeApp >>= \(MkTypeApp _ as) => rights (toList as) >>= allVarNames
+
171 |       let preLTR = SortedSet.fromList $ mapMaybe (lookup' conArgIdxs) preLTR
+
172 |
+
173 |       -- Find rightmost arguments among `preLTR`
+
174 |       let depsLTR = SortedSet.fromList $
+
175 |                       mapMaybe (\(ds, idx) => whenT .| contains idx preLTR && null ds .| idx) $
+
176 |                         toListI $ rawDeps <&> intersection preLTR . (`difference` givs)
+
177 |
+
178 |       ---------------------------------------------------------------------------------
+
179 |       -- Main right-to-left generation phase (3rd phase aka 2nd right-to-left phase) --
+
180 |       ---------------------------------------------------------------------------------
+
181 |
+
182 |       -- Arguments that no other argument depends on
+
183 |       let rightmostArgs = fromFoldable {f=Vect _} range `difference` (givs `union` dependees)
+
184 |
+
185 |       ---------------------------------------------------------------
+
186 |       -- Manage different possible variants of generation ordering --
+
187 |       ---------------------------------------------------------------
+
188 |
+
189 |       -- Prepare info about which arguments are independent and thus can be ordered arbitrarily
+
190 |       let disjDeps = disjointDepSets rawDeps' givs
+
191 |
+
192 |       -- Acquire order(s) in what we will generate arguments
+
193 |       let allOrders = do
+
194 |         leftmost  <- indepPermutations' disjDeps depsLTR
+
195 |         rightmost <- indepPermutations' disjDeps rightmostArgs
+
196 |         pure $ leftmost ++ leftToRightArgs ++ rightmost
197 |
-
198 |       -- Acquire order(s) in what we will generate arguments
-
199 |       let allOrders = do
-
200 |         leftmost  <- indepPermutations' disjDeps depsLTR
-
201 |         rightmost <- indepPermutations' disjDeps rightmostArgs
-
202 |         pure $ leftmost ++ leftToRightArgs ++ rightmost
+
198 |       let allOrders = if simplificationHack then take 1 allOrders else allOrders
+
199 |       let allOrders = List.nub $ nub <$> allOrders
+
200 |
+
201 |       for_ allOrders $ \order =>
+
202 |         logPoint {level=10} "least-effort" [sig, con] "- used final order: \{order}"
203 |
-
204 |       let allOrders = if simplificationHack then take 1 allOrders else allOrders
-
205 |       let allOrders = List.nub $ nub <$> allOrders
-
206 |
-
207 |       for_ allOrders $ \order =>
-
208 |         logPoint {level=10} "least-effort" [sig, con] "- used final order: \{order}"
+
204 |       --------------------------
+
205 |       -- Producing the result --
+
206 |       --------------------------
+
207 |
+
208 |       callOneOf "\{show con.name} (orders)".label <$> traverse genForOrder allOrders
209 |
-
210 |       --------------------------
-
211 |       -- Producing the result --
-
212 |       --------------------------
-
213 |
-
214 |       callOneOf "\{show con.name} (orders)".label <$> traverse genForOrder allOrders
-
215 |
-
216 |       where
-
217 |
-
218 |         Interpolation (Fin con.args.length) where
-
219 |           interpolate i = case name $ index' con.args i of
-
220 |             Just (UN n) => "#\{show i} (\{show n})"
-
221 |             _           => "#\{show i}"
-
222 |
-
223 |         Foldable f => Interpolation (f $ Fin con.args.length) where
-
224 |           interpolate = ("[" ++) . (++ "]") . joinBy ", " . map interpolate . toList
-
225 |
-
226 |         -- TODO make this to be a `record` as soon as #2177 is fixed
-
227 |         data TypeApp : Type where
-
228 |           MkTypeApp :
-
229 |             (type : TypeInfo) ->
-
230 |             (0 _ : AllTyArgsNamed type) =>
-
231 |             (argTypes : Vect type.args.length .| Either (Fin con.args.length) TTImp) ->
-
232 |             TypeApp
-
233 |
-
234 |   ||| Best effort non-obligatory tactic tries to use as much external generators as possible
-
235 |   ||| but discards some there is a conflict between them.
-
236 |   ||| All possible non-conflicting layouts may be produced in the generated values list.
-
237 |   |||
-
238 |   ||| E.g. when we have external generators ``(a : _) -> (b : T ** C a b)`` and ``(b : T ** D b)`` and
-
239 |   ||| a constructor of form ``C a b -> D b -> ...``, we can use values from both pairs
-
240 |   ||| ``(a : _) -> (b : T ** C a b)`` with ``(b : T) -> D b`` and
-
241 |   ||| ``(a : _) -> (b : T) -> C a b`` with ``(b : T ** D b)``,
-
242 |   ||| i.e. to use both of external generators to form the generated values list
-
243 |   ||| but not obligatorily all the external generators at the same time.
-
244 |   export
-
245 |   [BestEffort] ConstructorDerivator where
-
246 |     consGenExpr sig con givs fuel = do
-
247 |       ?cons_body_besteff_nonoblig_rhs
-
248 |
-
249 | ||| "Obligatory" means that is some external generator is present and a constructor has
-
250 | ||| an argument of a type which is generated by this external generator, it must be used
-
251 | ||| in the constructor's generator.
-
252 | |||
-
253 | ||| Dependent types are important here, i.e. generator ``(a : _) -> (b ** C a b)``
-
254 | ||| is considered to be a generator for the type ``C``.
-
255 | ||| The problem with obligatory generators is that some external generators may be incompatible.
-
256 | |||
-
257 | |||   E.g. once we have ``(a : _) -> (b ** C a b)`` and ``(a ** b ** C a b)`` at the same time,
-
258 | |||   once ``C`` is used in the same constructor, we cannot guarantee that we will use both external generators.
+
210 |       where
+
211 |
+
212 |         Interpolation (Fin con.args.length) where
+
213 |           interpolate i = case name $ index' con.args i of
+
214 |             Just (UN n) => "#\{show i} (\{show n})"
+
215 |             _           => "#\{show i}"
+
216 |
+
217 |         Foldable f => Interpolation (f $ Fin con.args.length) where
+
218 |           interpolate = ("[" ++) . (++ "]") . joinBy ", " . map interpolate . toList
+
219 |
+
220 |         -- TODO make this to be a `record` as soon as #2177 is fixed
+
221 |         data TypeApp : Type where
+
222 |           MkTypeApp :
+
223 |             (type : TypeInfo) ->
+
224 |             (0 _ : AllTyArgsNamed type) =>
+
225 |             (argTypes : Vect type.args.length .| Either (Fin con.args.length) TTImp) ->
+
226 |             TypeApp
+
227 |
+
228 |   ||| Best effort non-obligatory tactic tries to use as much external generators as possible
+
229 |   ||| but discards some there is a conflict between them.
+
230 |   ||| All possible non-conflicting layouts may be produced in the generated values list.
+
231 |   |||
+
232 |   ||| E.g. when we have external generators ``(a : _) -> (b : T ** C a b)`` and ``(b : T ** D b)`` and
+
233 |   ||| a constructor of form ``C a b -> D b -> ...``, we can use values from both pairs
+
234 |   ||| ``(a : _) -> (b : T ** C a b)`` with ``(b : T) -> D b`` and
+
235 |   ||| ``(a : _) -> (b : T) -> C a b`` with ``(b : T ** D b)``,
+
236 |   ||| i.e. to use both of external generators to form the generated values list
+
237 |   ||| but not obligatorily all the external generators at the same time.
+
238 |   export
+
239 |   [BestEffort] ConstructorDerivator where
+
240 |     consGenExpr sig con givs fuel = do
+
241 |       ?cons_body_besteff_nonoblig_rhs
+
242 |
+
243 | ||| "Obligatory" means that is some external generator is present and a constructor has
+
244 | ||| an argument of a type which is generated by this external generator, it must be used
+
245 | ||| in the constructor's generator.
+
246 | |||
+
247 | ||| Dependent types are important here, i.e. generator ``(a : _) -> (b ** C a b)``
+
248 | ||| is considered to be a generator for the type ``C``.
+
249 | ||| The problem with obligatory generators is that some external generators may be incompatible.
+
250 | |||
+
251 | |||   E.g. once we have ``(a : _) -> (b ** C a b)`` and ``(a ** b ** C a b)`` at the same time,
+
252 | |||   once ``C`` is used in the same constructor, we cannot guarantee that we will use both external generators.
+
253 | |||
+
254 | |||   The same problem is present once we have external generators for ``(a : _) -> (b : T ** C a b)`` and ``(b : T ** D b)`` at the same time,
+
255 | |||   and both ``C`` and ``D`` are used in the same constructor with the same parameter of type ``T``,
+
256 | |||   i.e. when constructor have something like ``C a b -> D b -> ...``.
+
257 | |||
+
258 | |||   Notice, that this problem does not arise in constructors of type ``C a b1 -> D b2 -> ...``
259 | |||
-
260 | |||   The same problem is present once we have external generators for ``(a : _) -> (b : T ** C a b)`` and ``(b : T ** D b)`` at the same time,
-
261 | |||   and both ``C`` and ``D`` are used in the same constructor with the same parameter of type ``T``,
-
262 | |||   i.e. when constructor have something like ``C a b -> D b -> ...``.
-
263 | |||
-
264 | |||   Notice, that this problem does not arise in constructors of type ``C a b1 -> D b2 -> ...``
-
265 | |||
-
266 | ||| In this case, we cannot decide in general which value of type ``T`` to be used for generation is we have to use both generators.
-
267 | ||| We can either fail to generate a value for such constructor (``FailFast`` tactic),
-
268 | ||| or alternatively we can try to match all the generated values of type ``T`` from both generators
-
269 | ||| using ``DecEq`` and leave only intersection (``DecEqConflicts`` tactic).
-
270 | namespace ObligatoryExts
-
271 |
-
272 |   export
-
273 |   [FailFast] ConstructorDerivator where
-
274 |     consGenExpr sig con givs fuel = do
-
275 |       ?cons_body_obl_ff_rhs
-
276 |
-
277 |   export
-
278 |   [DecEqConflicts] ConstructorDerivator where
-
279 |     consGenExpr sig con givs fuel = do
-
280 |       ?cons_body_obl_deceq_rhs
-
281 |
+
260 | ||| In this case, we cannot decide in general which value of type ``T`` to be used for generation is we have to use both generators.
+
261 | ||| We can either fail to generate a value for such constructor (``FailFast`` tactic),
+
262 | ||| or alternatively we can try to match all the generated values of type ``T`` from both generators
+
263 | ||| using ``DecEq`` and leave only intersection (``DecEqConflicts`` tactic).
+
264 | namespace ObligatoryExts
+
265 |
+
266 |   export
+
267 |   [FailFast] ConstructorDerivator where
+
268 |     consGenExpr sig con givs fuel = do
+
269 |       ?cons_body_obl_ff_rhs
+
270 |
+
271 |   export
+
272 |   [DecEqConflicts] ConstructorDerivator where
+
273 |     consGenExpr sig con givs fuel = do
+
274 |       ?cons_body_obl_deceq_rhs
+
275 |
diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.ConsEntry.src.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.ConsEntry.src.html index 3ef229f40..768f6a053 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.ConsEntry.src.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.ConsEntry.src.html @@ -148,108 +148,104 @@
 27 |
 28 |   -- Acquire constructor's return type arguments
 29 |   let (conRetTy, conRetTypeArgs) = unAppAny con.type
-
 30 |   conRetTypeArgs <- for conRetTypeArgs $ \case -- resembles similar management from `Entry` module; they must be consistent
-
 31 |     PosApp e     => pure e
-
 32 |     NamedApp _ _ => failAt conFC "Named implicit applications (like to `\{show conRetTy}`) are not supported yet"
-
 33 |     AutoApp _    => failAt conFC "Auto-implicit applications (like to `\{show conRetTy}`) are not supported yet"
-
 34 |     WithApp _    => failAt conFC "Unexpected `with` application to `\{show conRetTy}` in a constructor's argument"
+
 30 |   let conRetTypeArgs = conRetTypeArgs <&> getExpr
+
 31 |
+
 32 |   -- Match lengths of `conRetTypeArgs` and `sig.targetType.args`
+
 33 |   let Yes conRetTypeArgsLengthCorrect = conRetTypeArgs.length `decEq` sig.targetType.args.length
+
 34 |     | No _ => failAt conFC "INTERNAL ERROR: length of the return type does not equal to the type's arguments count"
 35 |
-
 36 |   -- Match lengths of `conRetTypeArgs` and `sig.targetType.args`
-
 37 |   let Yes conRetTypeArgsLengthCorrect = conRetTypeArgs.length `decEq` sig.targetType.args.length
-
 38 |     | No _ => failAt conFC "INTERNAL ERROR: length of the return type does not equal to the type's arguments count"
-
 39 |
-
 40 |   let conRetTypeArg : Fin sig.targetType.args.length -> TTImp
-
 41 |       conRetTypeArg idx = index' conRetTypeArgs $ rewrite conRetTypeArgsLengthCorrect in idx
-
 42 |
-
 43 |   -- Determine names of the arguments of the constructor (as a function)
-
 44 |   let conArgNames = fromList $ argName <$> con.args
-
 45 |
-
 46 |   -- For given arguments, determine whether they are
-
 47 |   --   - just a free name
-
 48 |   --   - repeated name of another given parameter (need of `decEq`)
-
 49 |   --   - (maybe, deeply) constructor call (need to match)
-
 50 |   --   - function call on a free param (need to use "inverted function" filtering trick)
-
 51 |   --   - something else (cannot manage yet)
-
 52 |   deepConsApps <- for sig.givenParams.asVect $ \idx => do
-
 53 |     let argExpr = conRetTypeArg idx
-
 54 |     let Right analysed = analyseDeepConsApp True conArgNames argExpr
-
 55 |       | Left err => failAt conFC "Argument #\{show idx} is not supported yet, argument expression: \{show argExpr}, reason: \{err}"
-
 56 |     pure analysed
-
 57 |
-
 58 |   -- Acquire LHS bind expressions for the given parameters
-
 59 |   -- Determine pairs of names which should be `decEq`'ed
-
 60 |   let getAndInc : forall m. MonadState Nat m => m Nat
-
 61 |       getAndInc = get <* modify S
-
 62 |   ((givenConArgs, decEqedNames, _), bindExprs) <-
-
 63 |     runStateT (empty, empty, 0) {stateType=(SortedSet Name, SortedSet (String, String), Nat)} {m} $
-
 64 |       for deepConsApps $ \(appliedNames ** bindExprF=> do
-
 65 |         renamedAppliedNames <- for appliedNames.asVect $ \(name, typeDetermined) => do
-
 66 |           let bindName = bindNameRenamer name
-
 67 |           if cast typeDetermined
-
 68 |             then pure $ const `(_) -- no need to match type-determined parameter by hand
-
 69 |             else if contains name !get
-
 70 |             then do
-
 71 |               -- I'm using a name containing chars that cannot be present in the code parsed from the Idris frontend
-
 72 |               let substName = "to_be_deceqed^^" ++ bindName ++ show !getAndInc
-
 73 |               modify $ insert (bindName, substName)
-
 74 |               pure $ \alreadyMatchedRenames => bindVar $ if contains substName alreadyMatchedRenames then bindName else substName
-
 75 |             else modify (insert name) $> const (bindVar bindName)
-
 76 |         let _ : Vect appliedNames.length $ SortedSet String -> TTImp = renamedAppliedNames
-
 77 |         pure $ \alreadyMatchedRenames => bindExprF $ \idx => index idx renamedAppliedNames $ alreadyMatchedRenames
-
 78 |   let bindExprs = \alreadyMatchedRenames => bindExprs <&> \f => f alreadyMatchedRenames
-
 79 |
-
 80 |   -- Build a map from constructor's argument name to its index
-
 81 |   let conArgIdxs = SortedMap.fromList $ mapI con.args $ \idx, arg => (argName arg, idx)
-
 82 |
-
 83 |   -- Determine indices of constructor's arguments that are given
-
 84 |   givenConArgs <- for givenConArgs.asList $ \givenArgName => do
-
 85 |     let Just idx = lookup givenArgName conArgIdxs
-
 86 |       | Nothing => failAt conFC "INTERNAL ERROR: calculated given `\{show givenArgName}` is not found in an arguments list of the constructor"
-
 87 |     pure idx
-
 88 |
-
 89 |   -- Equalise index values which must be propositionally equal to some parameters
-
 90 |   -- NOTE: Here I do all `decEq`s in a row and then match them all against `Yes`.
-
 91 |   --       I could do this step by step and this could be more effective in large series.
-
 92 |   let deceqise : (lhs : Vect sig.givenParams.asList.length TTImp -> TTImp) -> (rhs : TTImp) -> Clause
-
 93 |       deceqise lhs rhs = step lhs empty $ orderLikeInCon decEqedNames where
-
 94 |
-
 95 |         step : (withlhs : Vect sig.givenParams.asList.length TTImp -> TTImp) ->
-
 96 |                (alreadyMatchedRenames : SortedSet String) ->
-
 97 |                (left : List (String, String)) ->
-
 98 |                Clause
-
 99 |         step withlhs matched [] = PatClause EmptyFC .| withlhs (bindExprs matched) .| rhs
-
100 |         step withlhs matched ((orig, renam)::rest) =
-
101 |           WithClause EmptyFC (withlhs $ bindExprs matched) MW
-
102 |             `(Decidable.Equality.decEq ~(varStr renam) ~(varStr orig))
-
103 |             Nothing []
-
104 |             [ -- happy case
-
105 |               step ((.$ `(Prelude.Yes Builtin.Refl)) . withlhs) (insert renam matched) rest
-
106 |             , -- empty case
-
107 |               PatClause EmptyFC .| withlhs (bindExprs matched) .$ `(Prelude.No _) .| `(empty)
-
108 |             ]
-
109 |
-
110 |         -- Order pairs by the first element like they are present in the constructor's signature
-
111 |         orderLikeInCon : Foldable f => f (String, String) -> List (String, String)
-
112 |         orderLikeInCon = do
-
113 |           let conArgStrNames = mapMaybe argStrName con.args
-
114 |           let conNameToIdx : SortedMap _ $ Fin conArgStrNames.length := fromList $ mapI conArgStrNames $ flip (,)
-
115 |           let [AsInCon] Ord (String, String) where
-
116 |                 compare (origL, renL) (origR, renR) = comparing (lookup' conNameToIdx) origL origR <+> compare renL renR
-
117 |           SortedSet.toList . foldl insert' (empty @{AsInCon})
-
118 |           where
-
119 |             argStrName : Arg -> Maybe String
-
120 |             argStrName $ MkArg {name=Just $ UN (Basic n), _} = Just n
-
121 |             argStrName _                                     = Nothing
-
122 |
-
123 |   -- Form the declaration cases of a function generating values of particular constructor
-
124 |   let fuelArg = "^cons_fuel^" -- I'm using a name containing chars that cannot be present in the code parsed from the Idris frontend
-
125 |   pure $
-
126 |     -- Happy case, given arguments conform out constructor's GADT indices
-
127 |     [ deceqise (callCanonic sig name $ bindVar fuelArg) !(consGenExpr sig con .| fromList givenConArgs .| varStr fuelArg) ]
-
128 |     ++ if all isSimpleBindVar $ bindExprs SortedSet.empty then [] {- do not produce dead code if the happy case handles everything already -} else
-
129 |       -- The rest case, if given arguments do not conform to the current constructor then return empty generator
-
130 |       [ callCanonic sig name implicitTrue (replicate _ implicitTrue) .= `(empty) ]
-
131 |
+
 36 |   let conRetTypeArg : Fin sig.targetType.args.length -> TTImp
+
 37 |       conRetTypeArg idx = index' conRetTypeArgs $ rewrite conRetTypeArgsLengthCorrect in idx
+
 38 |
+
 39 |   -- Determine names of the arguments of the constructor (as a function)
+
 40 |   let conArgNames = fromList $ argName <$> con.args
+
 41 |
+
 42 |   -- For given arguments, determine whether they are
+
 43 |   --   - just a free name
+
 44 |   --   - repeated name of another given parameter (need of `decEq`)
+
 45 |   --   - (maybe, deeply) constructor call (need to match)
+
 46 |   --   - function call on a free param (need to use "inverted function" filtering trick)
+
 47 |   --   - something else (cannot manage yet)
+
 48 |   deepConsApps <- for sig.givenParams.asVect $ \idx => do
+
 49 |     let argExpr = conRetTypeArg idx
+
 50 |     let Right analysed = analyseDeepConsApp True conArgNames argExpr
+
 51 |       | Left err => failAt conFC "Argument #\{show idx} is not supported yet, argument expression: \{show argExpr}, reason: \{err}"
+
 52 |     pure analysed
+
 53 |
+
 54 |   -- Acquire LHS bind expressions for the given parameters
+
 55 |   -- Determine pairs of names which should be `decEq`'ed
+
 56 |   let getAndInc : forall m. MonadState Nat m => m Nat
+
 57 |       getAndInc = get <* modify S
+
 58 |   ((givenConArgs, decEqedNames, _), bindExprs) <-
+
 59 |     runStateT (empty, empty, 0) {stateType=(SortedSet Name, SortedSet (String, String), Nat)} {m} $
+
 60 |       for deepConsApps $ \(appliedNames ** bindExprF=> do
+
 61 |         renamedAppliedNames <- for appliedNames.asVect $ \(name, typeDetermined) => do
+
 62 |           let bindName = bindNameRenamer name
+
 63 |           if cast typeDetermined
+
 64 |             then pure $ const implicitTrue -- no need to match type-determined parameter by hand
+
 65 |             else if contains name !get
+
 66 |             then do
+
 67 |               -- I'm using a name containing chars that cannot be present in the code parsed from the Idris frontend
+
 68 |               let substName = "to_be_deceqed^^" ++ bindName ++ show !getAndInc
+
 69 |               modify $ insert (bindName, substName)
+
 70 |               pure $ \alreadyMatchedRenames => bindVar $ if contains substName alreadyMatchedRenames then bindName else substName
+
 71 |             else modify (insert name) $> const (bindVar bindName)
+
 72 |         let _ : Vect appliedNames.length $ SortedSet String -> TTImp = renamedAppliedNames
+
 73 |         pure $ \alreadyMatchedRenames => bindExprF $ \idx => index idx renamedAppliedNames $ alreadyMatchedRenames
+
 74 |   let bindExprs = \alreadyMatchedRenames => bindExprs <&> \f => f alreadyMatchedRenames
+
 75 |
+
 76 |   -- Build a map from constructor's argument name to its index
+
 77 |   let conArgIdxs = SortedMap.fromList $ mapI con.args $ \idx, arg => (argName arg, idx)
+
 78 |
+
 79 |   -- Determine indices of constructor's arguments that are given
+
 80 |   givenConArgs <- for givenConArgs.asList $ \givenArgName => do
+
 81 |     let Just idx = lookup givenArgName conArgIdxs
+
 82 |       | Nothing => failAt conFC "INTERNAL ERROR: calculated given `\{show givenArgName}` is not found in an arguments list of the constructor"
+
 83 |     pure idx
+
 84 |
+
 85 |   -- Equalise index values which must be propositionally equal to some parameters
+
 86 |   -- NOTE: Here I do all `decEq`s in a row and then match them all against `Yes`.
+
 87 |   --       I could do this step by step and this could be more effective in large series.
+
 88 |   let deceqise : (lhs : Vect sig.givenParams.asList.length TTImp -> TTImp) -> (rhs : TTImp) -> Clause
+
 89 |       deceqise lhs rhs = step lhs empty $ orderLikeInCon decEqedNames where
+
 90 |
+
 91 |         step : (withlhs : Vect sig.givenParams.asList.length TTImp -> TTImp) ->
+
 92 |                (alreadyMatchedRenames : SortedSet String) ->
+
 93 |                (left : List (String, String)) ->
+
 94 |                Clause
+
 95 |         step withlhs matched [] = PatClause EmptyFC .| withlhs (bindExprs matched) .| rhs
+
 96 |         step withlhs matched ((orig, renam)::rest) =
+
 97 |           WithClause EmptyFC (withlhs $ bindExprs matched) MW
+
 98 |             `(Decidable.Equality.decEq ~(varStr renam) ~(varStr orig))
+
 99 |             Nothing []
+
100 |             [ -- happy case
+
101 |               step ((.$ `(Prelude.Yes Builtin.Refl)) . withlhs) (insert renam matched) rest
+
102 |             , -- empty case
+
103 |               PatClause EmptyFC .| withlhs (bindExprs matched) .$ `(Prelude.No _) .| `(empty)
+
104 |             ]
+
105 |
+
106 |         -- Order pairs by the first element like they are present in the constructor's signature
+
107 |         orderLikeInCon : Foldable f => f (String, String) -> List (String, String)
+
108 |         orderLikeInCon = do
+
109 |           let conArgStrNames = mapMaybe argStrName con.args
+
110 |           let conNameToIdx : SortedMap _ $ Fin conArgStrNames.length := fromList $ mapI conArgStrNames $ flip (,)
+
111 |           let [AsInCon] Ord (String, String) where
+
112 |                 compare (origL, renL) (origR, renR) = comparing (lookup' conNameToIdx) origL origR <+> compare renL renR
+
113 |           SortedSet.toList . foldl insert' (empty @{AsInCon})
+
114 |           where
+
115 |             argStrName : Arg -> Maybe String
+
116 |             argStrName $ MkArg {name=Just $ UN (Basic n), _} = Just n
+
117 |             argStrName _                                     = Nothing
+
118 |
+
119 |   -- Form the declaration cases of a function generating values of particular constructor
+
120 |   let fuelArg = "^cons_fuel^" -- I'm using a name containing chars that cannot be present in the code parsed from the Idris frontend
+
121 |   pure $
+
122 |     -- Happy case, given arguments conform out constructor's GADT indices
+
123 |     [ deceqise (callCanonic sig name $ bindVar fuelArg) !(consGenExpr sig con .| fromList givenConArgs .| varStr fuelArg) ]
+
124 |     ++ if all isSimpleBindVar $ bindExprs SortedSet.empty then [] {- do not produce dead code if the happy case handles everything already -} else
+
125 |       -- The rest case, if given arguments do not conform to the current constructor then return empty generator
+
126 |       [ callCanonic sig name implicitTrue (replicate _ implicitTrue) .= `(empty) ]
+
127 |
diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.Util.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.Util.html index fe7378d0d..de060329a 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.Util.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Core.Util.html @@ -61,4 +61,4 @@ -

Deriving.DepTyCheck.Gen.Core.Util

(source)

Reexports

importpublic Data.Fin.Split
importpublic Decidable.Equality
importpublic Deriving.DepTyCheck.Gen.Derive

Definitions

dataConsDetermInfo : Type
Totality: total
Visibility: public export
Constructors:
DeterminedByType : ConsDetermInfo
NotDeterminedByType : ConsDetermInfo

Hints:
CastBoolConsDetermInfo
CastConsDetermInfoBool
MonoidConsDetermInfo
SemigroupConsDetermInfo
BindExprFun : Nat->Type
Totality: total
Visibility: public export
DeepConsAnalysisRes : Bool->Type
Totality: total
Visibility: public export
analyseDeepConsApp : NamesInfoInTypes=> (collectConsDetermInfo : Bool) ->SortedSetName->TTImp->EitherString (DeepConsAnalysisRescollectConsDetermInfo)
  Analyses whether the given expression can be an expression of free variables applies (maybe deeply) to a number of data constructors.

Returns which of given free names are actually used in the given expression, in order of appearance in the expression.
Notice that applied free names may repeat as soon as one name is used several times in the given expression.

Also, a function returning a bind expression (an expression replacing all free names with bind names (`IBindVar`))
is also returned.
This function requires bind variable names as input.
It returns correct bind expression only when all given bind names are different.

Totality: total
Visibility: export
+

Deriving.DepTyCheck.Gen.Core.Util

(source)

Reexports

importpublic Data.Fin.Split
importpublic Decidable.Equality
importpublic Deriving.DepTyCheck.Gen.Derive

Definitions

dataConsDetermInfo : Type
Totality: total
Visibility: public export
Constructors:
DeterminedByType : ConsDetermInfo
NotDeterminedByType : ConsDetermInfo

Hints:
CastBoolConsDetermInfo
CastConsDetermInfoBool
MonoidConsDetermInfo
SemigroupConsDetermInfo
BindExprFun : Nat->Type
Totality: total
Visibility: public export
DeepConsAnalysisRes : Bool->Type
Totality: total
Visibility: public export
analyseDeepConsApp : NamesInfoInTypes=> (collectConsDetermInfo : Bool) ->SortedSetName->TTImp->EitherString (DeepConsAnalysisRescollectConsDetermInfo)
  Analyses whether the given expression can be an expression of free variables applies (maybe deeply) to a number of data constructors.

Returns which of given free names are actually used in the given expression, in order of appearance in the expression.
Notice that applied free names may repeat as soon as one name is used several times in the given expression.

Also, a function returning a bind expression (an expression replacing all free names with bind names (`IBindVar`))
is also returned.
This function requires bind variable names as input.
It returns correct bind expression only when all given bind names are different.

Totality: total
Visibility: export
diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Derive.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Derive.html index b05a3e219..34817a720 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Derive.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Derive.html @@ -62,4 +62,4 @@

Deriving.DepTyCheck.Gen.Derive

(source)
Interfaces for using a derivator
-

Reexports

importpublic Control.Monad.Error.Interface
importpublic Data.SortedMap
importpublic Data.SortedMap.Dependent
importpublic Data.SortedSet
importpublic Deriving.DepTyCheck.Util.Reflection

Definitions

recordGenSignature : Type
Totality: total
Visibility: public export
Constructor: 
MkGenSignature : (targetType : TypeInfo) -> {auto0_ : AllTyArgsNamedtargetType} ->SortedSet (Fin ((targetType.args) .length)) ->GenSignature

Projections:
.givenParams : ({rec:0} : GenSignature) ->SortedSet (Fin (((targetType{rec:0}) .args) .length))
.targetType : GenSignature->TypeInfo
0.targetTypeCorrect : ({rec:0} : GenSignature) ->AllTyArgsNamed (targetType{rec:0})

Hints:
EqGenSignature
OrdGenSignature
SingleLogPositionGenSignature
.targetType : GenSignature->TypeInfo
Totality: total
Visibility: public export
targetType : GenSignature->TypeInfo
Totality: total
Visibility: public export
0.targetTypeCorrect : ({rec:0} : GenSignature) ->AllTyArgsNamed (targetType{rec:0})
Totality: total
Visibility: public export
0targetTypeCorrect : ({rec:0} : GenSignature) ->AllTyArgsNamed (targetType{rec:0})
Totality: total
Visibility: public export
.givenParams : ({rec:0} : GenSignature) ->SortedSet (Fin (((targetType{rec:0}) .args) .length))
Totality: total
Visibility: public export
givenParams : ({rec:0} : GenSignature) ->SortedSet (Fin (((targetType{rec:0}) .args) .length))
Totality: total
Visibility: public export
characteristics : GenSignature-> (String, ListNat)
Totality: total
Visibility: export
.generatedParams : (sig : GenSignature) ->SortedSet (Fin (((sig.targetType) .args) .length))
Totality: total
Visibility: public export
interfaceCanonicGen : (Type->Type) ->Type
Parameters: m
Constraints: Elaboration m, NamesInfoInTypes
Methods:
callGen : (sig : GenSignature) ->TTImp->Vect ((sig.givenParams) .size) TTImp->mTTImp

Implementations:
DerivatorCore=>ClojuringContextm=>Elaborationm=>NamesInfoInTypes=>CanonicGenm
CanonicGenm=>MonadTranst=>Monad (tm) =>CanonicGen (tm)
callGen : CanonicGenm=> (sig : GenSignature) ->TTImp->Vect ((sig.givenParams) .size) TTImp->mTTImp
Totality: total
Visibility: public export
canonicSig : GenSignature->TTImp
Totality: total
Visibility: export
callCanonic : (0sig : GenSignature) ->Name->TTImp->Vect ((sig.givenParams) .size) TTImp->TTImp
Totality: total
Visibility: export
interfaceDerivatorCore : Type
Methods:
canonicBody : CanonicGenm=>GenSignature->Name->m (ListClause)

Implementation: 
ConstructorDerivator=>DerivatorCore
canonicBody : DerivatorCore=>CanonicGenm=>GenSignature->Name->m (ListClause)
Totality: total
Visibility: public export
canonicDefaultLHS' : (String->String) ->GenSignature->Name->String->TTImp
Totality: total
Visibility: export
canonicDefaultRHS' : (String->String) ->GenSignature->Name->TTImp->TTImp
Totality: total
Visibility: export
canonicDefaultLHS : GenSignature->Name->String->TTImp
Totality: total
Visibility: export
canonicDefaultRHS : GenSignature->Name->TTImp->TTImp
Totality: total
Visibility: export
deriveCanonical : DerivatorCore=>CanonicGenm=>GenSignature->Name->m (Decl, Decl)
Totality: total
Visibility: export
+

Reexports

importpublic Control.Monad.Error.Interface
importpublic Data.SortedMap
importpublic Data.SortedMap.Dependent
importpublic Data.SortedSet
importpublic Deriving.DepTyCheck.Util.Reflection

Definitions

recordGenSignature : Type
Totality: total
Visibility: public export
Constructor: 
MkGenSignature : (targetType : TypeInfo) -> {auto0_ : AllTyArgsNamedtargetType} ->SortedSet (Fin ((targetType.args) .length)) ->GenSignature

Projections:
.givenParams : ({rec:0} : GenSignature) ->SortedSet (Fin (((targetType{rec:0}) .args) .length))
.targetType : GenSignature->TypeInfo
0.targetTypeCorrect : ({rec:0} : GenSignature) ->AllTyArgsNamed (targetType{rec:0})

Hints:
EqGenSignature
OrdGenSignature
SingleLogPositionGenSignature
.targetType : GenSignature->TypeInfo
Totality: total
Visibility: public export
targetType : GenSignature->TypeInfo
Totality: total
Visibility: public export
0.targetTypeCorrect : ({rec:0} : GenSignature) ->AllTyArgsNamed (targetType{rec:0})
Totality: total
Visibility: public export
0targetTypeCorrect : ({rec:0} : GenSignature) ->AllTyArgsNamed (targetType{rec:0})
Totality: total
Visibility: public export
.givenParams : ({rec:0} : GenSignature) ->SortedSet (Fin (((targetType{rec:0}) .args) .length))
Totality: total
Visibility: public export
givenParams : ({rec:0} : GenSignature) ->SortedSet (Fin (((targetType{rec:0}) .args) .length))
Totality: total
Visibility: public export
characteristics : GenSignature-> (String, ListNat)
Totality: total
Visibility: export
.generatedParams : (sig : GenSignature) ->SortedSet (Fin (((sig.targetType) .args) .length))
Totality: total
Visibility: public export
interfaceCanonicGen : (Type->Type) ->Type
Parameters: m
Constraints: Elaboration m, NamesInfoInTypes
Methods:
callGen : (sig : GenSignature) ->TTImp->Vect ((sig.givenParams) .size) TTImp->mTTImp

Implementations:
DerivatorCore=>ClojuringContextm=>Elaborationm=>NamesInfoInTypes=>CanonicGenm
CanonicGenm=>MonadTranst=>Monad (tm) =>CanonicGen (tm)
callGen : CanonicGenm=> (sig : GenSignature) ->TTImp->Vect ((sig.givenParams) .size) TTImp->mTTImp
Totality: total
Visibility: public export
canonicSig : GenSignature->TTImp
Totality: total
Visibility: export
callCanonic : (0sig : GenSignature) ->Name->TTImp->Vect ((sig.givenParams) .size) TTImp->TTImp
Totality: total
Visibility: export
interfaceDerivatorCore : Type
Methods:
canonicBody : CanonicGenm=>GenSignature->Name->m (ListClause)

Implementation: 
ConstructorDerivator=>DerivatorCore
canonicBody : DerivatorCore=>CanonicGenm=>GenSignature->Name->m (ListClause)
Totality: total
Visibility: public export
canonicDefaultLHS' : (String->String) ->GenSignature->Name->String->TTImp
Totality: total
Visibility: export
canonicDefaultRHS' : (String->String) ->GenSignature->Name->TTImp->TTImp
Totality: total
Visibility: export
canonicDefaultLHS : GenSignature->Name->String->TTImp
Totality: total
Visibility: export
canonicDefaultRHS : GenSignature->Name->TTImp->TTImp
Totality: total
Visibility: export
deriveCanonical : DerivatorCore=>CanonicGenm=>GenSignature->Name->m (Decl, Decl)
Totality: total
Visibility: export
diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Entry.src.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Entry.src.html index ecb32ac30..0398024ca 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Entry.src.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Gen.Entry.src.html @@ -228,286 +228,282 @@
107 |   let (targetType, targetTypeArgs) = unAppAny targetType
108 |
109 |   -- check out applications types
-
110 |   targetTypeArgs <- for targetTypeArgs $ \case
-
111 |     PosApp     arg => pure arg
-
112 |     NamedApp n arg => failAt targetTypeFC "Target types with implicit type parameters are not supported yet"
-
113 |     AutoApp    arg => failAt targetTypeFC "Target types with `auto` implicit type parameters are not supported yet"
-
114 |     WithApp    arg => failAt targetTypeFC "Unexpected `with`-application in the target type"
+
110 |   let targetTypeArgs = targetTypeArgs <&> getExpr
+
111 |
+
112 |   ------------------------------------------
+
113 |   -- Working with the target type familly --
+
114 |   ------------------------------------------
115 |
-
116 |   ------------------------------------------
-
117 |   -- Working with the target type familly --
-
118 |   ------------------------------------------
-
119 |
-
120 |   -- acquire `TypeInfo` out of the target type `TTImp` expression
-
121 |   targetType <- case targetType of
-
122 |
-
123 |     -- Normal type
-
124 |     IVar _ targetType => getInfo' targetType <|> failAt genFC "Target type `\{show targetType}` is not a top-level data definition"
-
125 |
-
126 |     -- Primitive type
-
127 |     IPrimVal _ (PrT t) => pure $ typeInfoForPrimType t
-
128 |
-
129 |     -- Type of types
-
130 |     IType _ => pure typeInfoForTypeOfTypes
-
131 |
-
132 |     _ => failAt targetTypeFC "Target type is not a simple name"
-
133 |
-
134 |   -- check that target type has all unnamed arguments resolved with machine-generated names
-
135 |   _ <- ensureTyArgsNamed targetType
+
116 |   -- acquire `TypeInfo` out of the target type `TTImp` expression
+
117 |   targetType <- case targetType of
+
118 |
+
119 |     -- Normal type
+
120 |     IVar _ targetType => getInfo' targetType <|> failAt genFC "Target type `\{show targetType}` is not a top-level data definition"
+
121 |
+
122 |     -- Primitive type
+
123 |     IPrimVal _ (PrT t) => pure $ typeInfoForPrimType t
+
124 |
+
125 |     -- Type of types
+
126 |     IType _ => pure typeInfoForTypeOfTypes
+
127 |
+
128 |     _ => failAt targetTypeFC "Target type is not a simple name"
+
129 |
+
130 |   -- check that target type has all unnamed arguments resolved with machine-generated names
+
131 |   _ <- ensureTyArgsNamed targetType
+
132 |
+
133 |   --------------------------------------------------
+
134 |   -- Target type family's arguments' first checks --
+
135 |   --------------------------------------------------
136 |
-
137 |   --------------------------------------------------
-
138 |   -- Target type family's arguments' first checks --
-
139 |   --------------------------------------------------
-
140 |
-
141 |   -- check all the arguments of the target type are variable names, not complex expressions
-
142 |   targetTypeArgs <- for targetTypeArgs $ \case
-
143 |     IVar _ (UN argName) => pure argName
-
144 |     nonVarArg => failAt (getFC nonVarArg) "Target type's argument must be a variable name"
+
137 |   -- check all the arguments of the target type are variable names, not complex expressions
+
138 |   targetTypeArgs <- for targetTypeArgs $ \case
+
139 |     IVar _ (UN argName) => pure argName
+
140 |     nonVarArg => failAt (getFC nonVarArg) "Target type's argument must be a variable name"
+
141 |
+
142 |   -- check that all arguments names are unique
+
143 |   let [] = findDiffPairWhich (==) targetTypeArgs
+
144 |     | _ :: _ => failAt targetTypeFC "All arguments of the target type must be different"
145 |
-
146 |   -- check that all arguments names are unique
-
147 |   let [] = findDiffPairWhich (==) targetTypeArgs
-
148 |     | _ :: _ => failAt targetTypeFC "All arguments of the target type must be different"
+
146 |   -- check the given type info corresponds to the given type application, and convert a `List` to an appropriate `Vect`
+
147 |   let Yes targetTypeArgsLengthCorrect = targetType.tyArgs.length `decEq` targetTypeArgs.length
+
148 |     | No _ => fail "INTERNAL ERROR: unequal argument lists lengths: \{show targetTypeArgs.length} and \{show targetType.args.length}"
149 |
-
150 |   -- check the given type info corresponds to the given type application, and convert a `List` to an appropriate `Vect`
-
151 |   let Yes targetTypeArgsLengthCorrect = targetType.tyArgs.length `decEq` targetTypeArgs.length
-
152 |     | No _ => fail "INTERNAL ERROR: unequal argument lists lengths: \{show targetTypeArgs.length} and \{show targetType.args.length}"
+
150 |   ------------------------------------------------------------
+
151 |   -- Parse `Reflect` structures to what's needed to further --
+
152 |   ------------------------------------------------------------
153 |
-
154 |   ------------------------------------------------------------
-
155 |   -- Parse `Reflect` structures to what's needed to further --
-
156 |   ------------------------------------------------------------
-
157 |
-
158 |   -- check that all parameters of `DPair` are as expected
-
159 |   paramsToBeGenerated <- for paramsToBeGenerated $ \case
-
160 |     MkArg MW ExplicitArg (Just $ UN nm) t => pure (nm, t)
-
161 |     _                                     => failAt (getFC sigResult) "Argument of dependent pair under the resulting `Gen` must be named"
-
162 |
-
163 |   -- check that all arguments are omega, not erased or linear; and that all arguments are properly named
-
164 |   (givenParams, autoImplArgs, givenParamsPositions) <- do
-
165 |     let
-
166 |       classifyArg : forall m. Elaboration m =>
-
167 |                     Arg -> m $ Either (ArgExplicitness, UserName, TTImp) TTImp
-
168 |       classifyArg $ MkArg MW ImplicitArg (Just $ UN name) type = pure $ Left (Checked.ImplicitArg, name, type)
-
169 |       classifyArg $ MkArg MW ExplicitArg (Just $ UN name) type = pure $ Left (Checked.ExplicitArg, name, type)
-
170 |       classifyArg $ MkArg MW AutoImplicit (Just $ MN _ _) type = pure $ Right type
-
171 |       classifyArg $ MkArg MW AutoImplicit Nothing         type = pure $ Right type
+
154 |   -- check that all parameters of `DPair` are as expected
+
155 |   paramsToBeGenerated <- for paramsToBeGenerated $ \case
+
156 |     MkArg MW ExplicitArg (Just $ UN nm) t => pure (nm, t)
+
157 |     _                                     => failAt (getFC sigResult) "Argument of dependent pair under the resulting `Gen` must be named"
+
158 |
+
159 |   -- check that all arguments are omega, not erased or linear; and that all arguments are properly named
+
160 |   (givenParams, autoImplArgs, givenParamsPositions) <- do
+
161 |     let
+
162 |       classifyArg : forall m. Elaboration m =>
+
163 |                     Arg -> m $ Either (ArgExplicitness, UserName, TTImp) TTImp
+
164 |       classifyArg $ MkArg MW ImplicitArg (Just $ UN name) type = pure $ Left (Checked.ImplicitArg, name, type)
+
165 |       classifyArg $ MkArg MW ExplicitArg (Just $ UN name) type = pure $ Left (Checked.ExplicitArg, name, type)
+
166 |       classifyArg $ MkArg MW AutoImplicit (Just $ MN _ _) type = pure $ Right type
+
167 |       classifyArg $ MkArg MW AutoImplicit Nothing         type = pure $ Right type
+
168 |
+
169 |       classifyArg $ MkArg MW ImplicitArg     _ ty = failAt (getFC ty) "Implicit argument must be named and must not shadow any other name"
+
170 |       classifyArg $ MkArg MW ExplicitArg     _ ty = failAt (getFC ty) "Explicit argument must be named and must not shadow any other name"
+
171 |       classifyArg $ MkArg MW AutoImplicit    _ ty = failAt (getFC ty) "Auto-implicit argument must be unnamed"
172 |
-
173 |       classifyArg $ MkArg MW ImplicitArg     _ ty = failAt (getFC ty) "Implicit argument must be named and must not shadow any other name"
-
174 |       classifyArg $ MkArg MW ExplicitArg     _ ty = failAt (getFC ty) "Explicit argument must be named and must not shadow any other name"
-
175 |       classifyArg $ MkArg MW AutoImplicit    _ ty = failAt (getFC ty) "Auto-implicit argument must be unnamed"
+
173 |       classifyArg $ MkArg M0 _               _ ty = failAt (getFC ty) "Erased arguments are not supported in generator function signatures"
+
174 |       classifyArg $ MkArg M1 _               _ ty = failAt (getFC ty) "Linear arguments are not supported in generator function signatures"
+
175 |       classifyArg $ MkArg MW (DefImplicit _) _ ty = failAt (getFC ty) "Default implicit arguments are not supported in generator function signatures"
176 |
-
177 |       classifyArg $ MkArg M0 _               _ ty = failAt (getFC ty) "Erased arguments are not supported in generator function signatures"
-
178 |       classifyArg $ MkArg M1 _               _ ty = failAt (getFC ty) "Linear arguments are not supported in generator function signatures"
-
179 |       classifyArg $ MkArg MW (DefImplicit _) _ ty = failAt (getFC ty) "Default implicit arguments are not supported in generator function signatures"
-
180 |
-
181 |     map partitionEithersPos $ for sigArgs.asVect classifyArg
+
177 |     map partitionEithersPos $ for sigArgs.asVect classifyArg
+
178 |
+
179 |   ----------------------------------------------------------------------
+
180 |   -- Check that generated and given parameter lists are actually sets --
+
181 |   ----------------------------------------------------------------------
182 |
-
183 |   ----------------------------------------------------------------------
-
184 |   -- Check that generated and given parameter lists are actually sets --
-
185 |   ----------------------------------------------------------------------
+
183 |   -- check that all parameters in `parametersToBeGenerated` have different names
+
184 |   let [] = findDiffPairWhich ((==) `on` fst) paramsToBeGenerated
+
185 |     | (_, (_, ty)) :: _ => failAt (getFC ty) "Name of the argument is not unique in the dependent pair under the resulting `Gen`"
186 |
-
187 |   -- check that all parameters in `parametersToBeGenerated` have different names
-
188 |   let [] = findDiffPairWhich ((==) `on` fst) paramsToBeGenerated
-
189 |     | (_, (_, ty)) :: _ => failAt (getFC ty) "Name of the argument is not unique in the dependent pair under the resulting `Gen`"
+
187 |   -- check that all given parameters have different names
+
188 |   let [] = findDiffPairWhich ((==) `on` \(_, n, _) => n) givenParams
+
189 |     | (_, (_, _, ty)) :: _ => failAt (getFC ty) "Name of the generator function's argument is not unique"
190 |
-
191 |   -- check that all given parameters have different names
-
192 |   let [] = findDiffPairWhich ((==) `on` \(_, n, _) => n) givenParams
-
193 |     | (_, (_, _, ty)) :: _ => failAt (getFC ty) "Name of the generator function's argument is not unique"
+
191 |   -----------------------------------------------------------------------
+
192 |   -- Link generated and given parameters lists to the `targetTypeArgs` --
+
193 |   -----------------------------------------------------------------------
194 |
-
195 |   -----------------------------------------------------------------------
-
196 |   -- Link generated and given parameters lists to the `targetTypeArgs` --
-
197 |   -----------------------------------------------------------------------
-
198 |
-
199 |   -- check that all parameters to be generated are actually used inside the target type
-
200 |   paramsToBeGenerated <- for {b=(_, Fin targetType.args.length)} paramsToBeGenerated $ \(name, ty) => case findIndex (== name) targetTypeArgs of
-
201 |     Just found => pure (ty, rewrite targetTypeArgsLengthCorrect in found)
-
202 |     Nothing => failAt (getFC ty) "Generated parameter is not used in the target type"
-
203 |
-
204 |   -- check that all target type's parameters classied as "given" are present in the given params list
-
205 |   givenParams <- for {b=(_, Fin targetType.args.length, _)} givenParams $ \(explicitness, name, ty) => case findIndex (== name) targetTypeArgs of
-
206 |     Just found => pure (ty, rewrite targetTypeArgsLengthCorrect in found, explicitness, UN name)
-
207 |     Nothing => failAt (getFC ty) "Given parameter is not used in the target type"
+
195 |   -- check that all parameters to be generated are actually used inside the target type
+
196 |   paramsToBeGenerated <- for {b=(_, Fin targetType.args.length)} paramsToBeGenerated $ \(name, ty) => case findIndex (== name) targetTypeArgs of
+
197 |     Just found => pure (ty, rewrite targetTypeArgsLengthCorrect in found)
+
198 |     Nothing => failAt (getFC ty) "Generated parameter is not used in the target type"
+
199 |
+
200 |   -- check that all target type's parameters classied as "given" are present in the given params list
+
201 |   givenParams <- for {b=(_, Fin targetType.args.length, _)} givenParams $ \(explicitness, name, ty) => case findIndex (== name) targetTypeArgs of
+
202 |     Just found => pure (ty, rewrite targetTypeArgsLengthCorrect in found, explicitness, UN name)
+
203 |     Nothing => failAt (getFC ty) "Given parameter is not used in the target type"
+
204 |
+
205 |   -- check the increasing order of generated params
+
206 |   let [] = findConsequentsWhich ((>=) `on` snd) paramsToBeGenerated
+
207 |     | (_, (ty, _)) :: _ => failAt (getFC ty) "Generated arguments must go in the same order as in the target type"
208 |
-
209 |   -- check the increasing order of generated params
-
210 |   let [] = findConsequentsWhich ((>=) `on` snd) paramsToBeGenerated
-
211 |     | (_, (ty, _)) :: _ => failAt (getFC ty) "Generated arguments must go in the same order as in the target type"
+
209 |   -- check the increasing order of given params
+
210 |   let [] = findConsequentsWhich ((>=) `on` \(_, n, _) => n) givenParams
+
211 |     | (_, (ty, _, _)) :: _ => failAt (getFC ty) "Given arguments must go in the same order as in the target type"
212 |
-
213 |   -- check the increasing order of given params
-
214 |   let [] = findConsequentsWhich ((>=) `on` \(_, n, _) => n) givenParams
-
215 |     | (_, (ty, _, _)) :: _ => failAt (getFC ty) "Given arguments must go in the same order as in the target type"
-
216 |
-
217 |   -- make unable to use generated params list
-
218 |   let 0 paramsToBeGenerated = paramsToBeGenerated
-
219 |
-
220 |   -- forget the order of the given params, convert to a map from index to explicitness
-
221 |   let givenParams = fromList $ snd <$> givenParams
-
222 |
-
223 |   -- make the resulting signature
-
224 |   let genSig = MkExternalGenSignature {targetType, givenParams}
+
213 |   -- make unable to use generated params list
+
214 |   let 0 paramsToBeGenerated = paramsToBeGenerated
+
215 |
+
216 |   -- forget the order of the given params, convert to a map from index to explicitness
+
217 |   let givenParams = fromList $ snd <$> givenParams
+
218 |
+
219 |   -- make the resulting signature
+
220 |   let genSig = MkExternalGenSignature {targetType, givenParams}
+
221 |
+
222 |   -------------------------------------
+
223 |   -- Auto-implicit generators checks --
+
224 |   -------------------------------------
225 |
-
226 |   -------------------------------------
-
227 |   -- Auto-implicit generators checks --
-
228 |   -------------------------------------
-
229 |
-
230 |   -- check that external gen does not have its own external gens
-
231 |   when (isExternalGen checkSide) $
-
232 |     when (not $ null autoImplArgs) $
-
233 |       failAt genFC "Auto-implicit argument should not contain its own auto-implicit arguments"
-
234 |
-
235 |   -- check all auto-implicit arguments pass the checks for the `Gen` in an appropriate context
-
236 |   autoImplArgs <- for autoImplArgs $ \tti => mapSnd (,tti) <$> checkTypeIsGen ExternalGen (assert_smaller sig tti)
+
226 |   -- check that external gen does not have its own external gens
+
227 |   when (isExternalGen checkSide) $
+
228 |     when (not $ null autoImplArgs) $
+
229 |       failAt genFC "Auto-implicit argument should not contain its own auto-implicit arguments"
+
230 |
+
231 |   -- check all auto-implicit arguments pass the checks for the `Gen` in an appropriate context
+
232 |   autoImplArgs <- for autoImplArgs $ \tti => mapSnd (,tti) <$> checkTypeIsGen ExternalGen (assert_smaller sig tti)
+
233 |
+
234 |   -- check that all auto-imlicit arguments are unique
+
235 |   let [] = findDiffPairWhich ((==) `on` \(_, sig, _) => sig) autoImplArgs
+
236 |     | (_, (fc, _)) :: _ => failAt fc.targetTypeFC "Repetition of an auto-implicit external generator"
237 |
-
238 |   -- check that all auto-imlicit arguments are unique
-
239 |   let [] = findDiffPairWhich ((==) `on` \(_, sig, _) => sig) autoImplArgs
-
240 |     | (_, (fc, _)) :: _ => failAt fc.targetTypeFC "Repetition of an auto-implicit external generator"
+
238 |   -- check that the resulting generator is not in externals
+
239 |   let Nothing = find ((== genSig) . \(_, sig, _) => sig) autoImplArgs
+
240 |     | Just (fc, _) => failAt fc.genFC "External generators contain the generator asked to be derived"
241 |
-
242 |   -- check that the resulting generator is not in externals
-
243 |   let Nothing = find ((== genSig) . \(_, sig, _) => sig) autoImplArgs
-
244 |     | Just (fc, _) => failAt fc.genFC "External generators contain the generator asked to be derived"
-
245 |
-
246 |   -- forget FCs of subparsed externals
-
247 |   let autoImplArgs = snd <$> autoImplArgs
+
242 |   -- forget FCs of subparsed externals
+
243 |   let autoImplArgs = snd <$> autoImplArgs
+
244 |
+
245 |   ------------
+
246 |   -- Result --
+
247 |   ------------
248 |
-
249 |   ------------
-
250 |   -- Result --
-
251 |   ------------
-
252 |
-
253 |   case checkSide of
-
254 |     DerivationTask => do
-
255 |       let Yes prf = genSig.givenParams.size + autoImplArgs.length `decEq` sigArgs.length
-
256 |         | No _ => fail $ "INTERNAL ERROR: positions length is incorrect"
-
257 |                       ++ ", \{show sigArgs.length} is not \{show genSig.givenParams.size} + \{show autoImplArgs.length}"
-
258 |       pure (genSig ** MkGenExternals autoImplArgs ** rewrite prf in givenParamsPositions)
-
259 |     ExternalGen    => do
-
260 |       let fc = MkGenSignatureFC {sigFC=getFC sig, genFC, targetTypeFC}
-
261 |       pure (fc, genSig)
-
262 |
-
263 | --- Boundaries between external and internal generator functions ---
+
249 |   case checkSide of
+
250 |     DerivationTask => do
+
251 |       let Yes prf = genSig.givenParams.size + autoImplArgs.length `decEq` sigArgs.length
+
252 |         | No _ => fail $ "INTERNAL ERROR: positions length is incorrect"
+
253 |                       ++ ", \{show sigArgs.length} is not \{show genSig.givenParams.size} + \{show autoImplArgs.length}"
+
254 |       pure (genSig ** MkGenExternals autoImplArgs ** rewrite prf in givenParamsPositions)
+
255 |     ExternalGen    => do
+
256 |       let fc = MkGenSignatureFC {sigFC=getFC sig, genFC, targetTypeFC}
+
257 |       pure (fc, genSig)
+
258 |
+
259 | --- Boundaries between external and internal generator functions ---
+
260 |
+
261 | nameForGen : ExternalGenSignature -> Name
+
262 | nameForGen sig = let (ty, givs) = characteristics sig in UN $ Basic $ "external^<\{ty}>\{show givs}"
+
263 | -- I'm using `UN` but containing chars that cannot be present in the code parsed from the Idris frontend.
264 |
-
265 | nameForGen : ExternalGenSignature -> Name
-
266 | nameForGen sig = let (ty, givs) = characteristics sig in UN $ Basic $ "external^<\{ty}>\{show givs}"
-
267 | -- I'm using `UN` but containing chars that cannot be present in the code parsed from the Idris frontend.
+
265 | -- this is a workarond for Idris compiler bug #2983
+
266 | nameMod : Name -> Name
+
267 | nameMod n = UN $ Basic "outer^<\{show n}>"
268 |
-
269 | -- this is a workarond for Idris compiler bug #2983
-
270 | nameMod : Name -> Name
-
271 | nameMod n = UN $ Basic "outer^<\{show n}>"
-
272 |
-
273 | internalGenCallingLambda : Elaboration m => CheckResult DerivationTask -> TTImp -> m TTImp
-
274 | internalGenCallingLambda (sig ** exts ** givsPoscall = do
-
275 |     let Just args = joinEithersPos sig.givenParams.asList exts.externals givsPos
-
276 |       | Nothing => fail "INTERNAL ERROR: can't join partitioned args back"
-
277 |     pure $ foldr mkLam call args
-
278 |
-
279 |   where
-
280 |
-
281 |   -- either given param or auto param
-
282 |   mkLam : Either (Fin sig.targetType.args.length, ArgExplicitness, Name) (ExternalGenSignature, TTImp) -> TTImp -> TTImp
-
283 |   mkLam $ Left (idx, expl, name) = lam $ MkArg MW expl.toTT .| Just (nameMod name) .| implicitTrue -- (index' sig.targetType.args idx).type
-
284 |                                                                                    -- ^^^ no type because of `nameMod` above
-
285 |   mkLam $ Right (extSig, ty)     = lam $ MkArg MW AutoImplicit .| Just (nameForGen extSig) .| ty
-
286 |                                    -- TODO to think whether it's okay to calculate the name twice: here and below for a map
-
287 |
-
288 | callMainDerivedGen : CanonicGen m => ExternalGenSignature -> (fuelArg : Name) -> m TTImp
-
289 | callMainDerivedGen sig fuelArg =
-
290 |   let Element intSig prf = internalise sig in
-
291 |   callGen intSig (var fuelArg) $ rewrite prf in sig.givenParams.asVect <&> \(_, _, name) => var $ nameMod name
-
292 |
-
293 | wrapFuel : (fuelArg : Name) -> TTImp -> TTImp
-
294 | wrapFuel fuelArg = lam $ MkArg MW ExplicitArg (Just fuelArg) `(Data.Fuel.Fuel)
+
269 | internalGenCallingLambda : Elaboration m => CheckResult DerivationTask -> TTImp -> m TTImp
+
270 | internalGenCallingLambda (sig ** exts ** givsPoscall = do
+
271 |     let Just args = joinEithersPos sig.givenParams.asList exts.externals givsPos
+
272 |       | Nothing => fail "INTERNAL ERROR: can't join partitioned args back"
+
273 |     pure $ foldr mkLam call args
+
274 |
+
275 |   where
+
276 |
+
277 |   -- either given param or auto param
+
278 |   mkLam : Either (Fin sig.targetType.args.length, ArgExplicitness, Name) (ExternalGenSignature, TTImp) -> TTImp -> TTImp
+
279 |   mkLam $ Left (idx, expl, name) = lam $ MkArg MW expl.toTT .| Just (nameMod name) .| implicitTrue -- (index' sig.targetType.args idx).type
+
280 |                                                                                    -- ^^^ no type because of `nameMod` above
+
281 |   mkLam $ Right (extSig, ty)     = lam $ MkArg MW AutoImplicit .| Just (nameForGen extSig) .| ty
+
282 |                                    -- TODO to think whether it's okay to calculate the name twice: here and below for a map
+
283 |
+
284 | callMainDerivedGen : CanonicGen m => ExternalGenSignature -> (fuelArg : Name) -> m TTImp
+
285 | callMainDerivedGen sig fuelArg =
+
286 |   let Element intSig prf = internalise sig in
+
287 |   callGen intSig (var fuelArg) $ rewrite prf in sig.givenParams.asVect <&> \(_, _, name) => var $ nameMod name
+
288 |
+
289 | wrapFuel : (fuelArg : Name) -> TTImp -> TTImp
+
290 | wrapFuel fuelArg = lam $ MkArg MW ExplicitArg (Just fuelArg) `(Data.Fuel.Fuel)
+
291 |
+
292 | ------------------------------
+
293 | --- Functions for the user ---
+
294 | ------------------------------
295 |
-
296 | ------------------------------
-
297 | --- Functions for the user ---
-
298 | ------------------------------
-
299 |
-
300 | export
-
301 | deriveGenExpr : DerivatorCore => (signature : TTImp) -> Elab TTImp
-
302 | deriveGenExpr signature = do
-
303 |   checkResult@(signature ** externals ** _<- checkTypeIsGen DerivationTask signature
-
304 |   let externalsSigToName = fromList $ externals.externals <&> \(sig, _) => (sig, nameForGen sig)
-
305 |   let fuelArg = outmostFuelArg
-
306 |   niit <- logBounds "namesInfo" [] $ getNamesInfoInTypes signature.targetType
-
307 |   (callExpr, locals) <- runCanonic externalsSigToName $ callMainDerivedGen signature fuelArg
-
308 |   wrapFuel fuelArg <$> internalGenCallingLambda checkResult (local locals callExpr)
-
309 |
-
310 | ||| The entry-point function of automatic derivation of `Gen`'s.
-
311 | |||
-
312 | ||| Consider, you have a `data X (a : A) (b : B n) (c : C) where ...` and
-
313 | ||| you want a derived `Gen` for `X`.
-
314 | ||| Say, you want to have `a` and `c` parameters of `X` to be set by the caller and the `b` parameter to be generated.
-
315 | ||| For this your generator function should have a signature like `(a : A) -> (c : C) -> (n ** b : B n ** X a b c)`.
-
316 | ||| So, you need to define a function with this signature, say, named as `genX` and
-
317 | ||| to write `genX = deriveGen` as an implementation to make the body to be derived.
-
318 | |||
-
319 | ||| Say, you want `n` to be set by the caller and, as the same time, to be an implicit argument.
-
320 | ||| In this case, the signature of the main function to be derived,
-
321 | ||| becomes `{n : _} -> (a : A) -> (c : C) -> (b : B n ** X a b c)`.
-
322 | ||| But still, you can use this function `deriveGen` to derive a function with such signature.
+
296 | export
+
297 | deriveGenExpr : DerivatorCore => (signature : TTImp) -> Elab TTImp
+
298 | deriveGenExpr signature = do
+
299 |   checkResult@(signature ** externals ** _<- checkTypeIsGen DerivationTask signature
+
300 |   let externalsSigToName = fromList $ externals.externals <&> \(sig, _) => (sig, nameForGen sig)
+
301 |   let fuelArg = outmostFuelArg
+
302 |   niit <- logBounds "namesInfo" [] $ getNamesInfoInTypes signature.targetType
+
303 |   (callExpr, locals) <- runCanonic externalsSigToName $ callMainDerivedGen signature fuelArg
+
304 |   wrapFuel fuelArg <$> internalGenCallingLambda checkResult (local locals callExpr)
+
305 |
+
306 | ||| The entry-point function of automatic derivation of `Gen`'s.
+
307 | |||
+
308 | ||| Consider, you have a `data X (a : A) (b : B n) (c : C) where ...` and
+
309 | ||| you want a derived `Gen` for `X`.
+
310 | ||| Say, you want to have `a` and `c` parameters of `X` to be set by the caller and the `b` parameter to be generated.
+
311 | ||| For this your generator function should have a signature like `(a : A) -> (c : C) -> (n ** b : B n ** X a b c)`.
+
312 | ||| So, you need to define a function with this signature, say, named as `genX` and
+
313 | ||| to write `genX = deriveGen` as an implementation to make the body to be derived.
+
314 | |||
+
315 | ||| Say, you want `n` to be set by the caller and, as the same time, to be an implicit argument.
+
316 | ||| In this case, the signature of the main function to be derived,
+
317 | ||| becomes `{n : _} -> (a : A) -> (c : C) -> (b : B n ** X a b c)`.
+
318 | ||| But still, you can use this function `deriveGen` to derive a function with such signature.
+
319 | |||
+
320 | ||| Say, you want your generator to be parameterized with some external `Gen`'s.
+
321 | ||| Consider types `data Y where ...`, `data Z1 where ...` and `data Z2 (b : B n) where ...`.
+
322 | ||| For this, `auto`-parameters can be listed with `=>`-syntax in the signature.
323 | |||
-
324 | ||| Say, you want your generator to be parameterized with some external `Gen`'s.
-
325 | ||| Consider types `data Y where ...`, `data Z1 where ...` and `data Z2 (b : B n) where ...`.
-
326 | ||| For this, `auto`-parameters can be listed with `=>`-syntax in the signature.
-
327 | |||
-
328 | ||| For example, if you want to use `Gen Y` and `Gen`'s for `Z1` and `Z2` as external generators,
-
329 | ||| you can define your function in the following way:
-
330 | |||
-
331 | |||   ```idris
-
332 | |||   genX : Gen Y => Gen Z1 => ({n : _} -> {b : B n} -> Gen (Z2 b)) => {n : _} -> (a : A) -> (c : C) -> Gen (b : B n ** X a b c)
-
333 | |||   genX = deriveGen
-
334 | |||   ```
+
324 | ||| For example, if you want to use `Gen Y` and `Gen`'s for `Z1` and `Z2` as external generators,
+
325 | ||| you can define your function in the following way:
+
326 | |||
+
327 | |||   ```idris
+
328 | |||   genX : Gen Y => Gen Z1 => ({n : _} -> {b : B n} -> Gen (Z2 b)) => {n : _} -> (a : A) -> (c : C) -> Gen (b : B n ** X a b c)
+
329 | |||   genX = deriveGen
+
330 | |||   ```
+
331 | |||
+
332 | ||| Consider also, that you may be asked for having the `Fuel` argument as the first argument in the signature
+
333 | ||| due to (maybe, temporary) unability of `Gen`'s to manage infinite processes of values generation.
+
334 | ||| So, the example from above will look like this:
335 | |||
-
336 | ||| Consider also, that you may be asked for having the `Fuel` argument as the first argument in the signature
-
337 | ||| due to (maybe, temporary) unability of `Gen`'s to manage infinite processes of values generation.
-
338 | ||| So, the example from above will look like this:
-
339 | |||
-
340 | |||   ```idris
-
341 | |||   genX : Fuel -> (Fuel -> Gen Y) => (Fuel -> Gen Z1) => (Fuel -> {n : _} -> {b : B n} -> Gen (Z2 b)) =>
-
342 | |||          {n : _} -> (a : A) -> (c : C) -> Gen (b : B n ** X a b c)
-
343 | |||   genX = deriveGen
-
344 | |||   ```
-
345 | |||
-
346 | |||
-
347 | export %macro
-
348 | deriveGen : DerivatorCore => Elab a
-
349 | deriveGen = do
-
350 |   Just signature <- goal
-
351 |      | Nothing => fail "The goal signature is not found. Generators derivation must be used only for fully defined signatures"
-
352 |   tt <- deriveGenExpr signature
-
353 |   check tt
-
354 |
-
355 | ||| Alternative entry-point function of automatic derivation of `Gen`'s.
+
336 | |||   ```idris
+
337 | |||   genX : Fuel -> (Fuel -> Gen Y) => (Fuel -> Gen Z1) => (Fuel -> {n : _} -> {b : B n} -> Gen (Z2 b)) =>
+
338 | |||          {n : _} -> (a : A) -> (c : C) -> Gen (b : B n ** X a b c)
+
339 | |||   genX = deriveGen
+
340 | |||   ```
+
341 | |||
+
342 | |||
+
343 | export %macro
+
344 | deriveGen : DerivatorCore => Elab a
+
345 | deriveGen = do
+
346 |   Just signature <- goal
+
347 |      | Nothing => fail "The goal signature is not found. Generators derivation must be used only for fully defined signatures"
+
348 |   tt <- deriveGenExpr signature
+
349 |   check tt
+
350 |
+
351 | ||| Alternative entry-point function of automatic derivation of `Gen`'s.
+
352 | |||
+
353 | ||| This function can be used precisely as the `deriveGen`.
+
354 | ||| The only difference is that this function does not rely on somewhat fragile goal mechanism
+
355 | ||| allowing the user to pass the desired type explicitly.
356 | |||
-
357 | ||| This function can be used precisely as the `deriveGen`.
-
358 | ||| The only difference is that this function does not rely on somewhat fragile goal mechanism
-
359 | ||| allowing the user to pass the desired type explicitly.
-
360 | |||
-
361 | ||| Since Idris allows simple top-level definitions to not to contain type signature,
-
362 | ||| one can use this derivation function as a one-liner without repetition of a desired type, e.g.
-
363 | |||
-
364 | |||   ```idris
-
365 | |||   genX = deriveGenFor $ Fuel -> (Fuel -> Gen Y) => (a : A) -> (c : C) -> Gen (b ** X a b c)
-
366 | |||   ```
-
367 | export %macro
-
368 | deriveGenFor : DerivatorCore => (0 a : Type) -> Elab a
-
369 | deriveGenFor a = do
-
370 |   sig <- quote a
-
371 |   tt <- deriveGenExpr sig
-
372 |   check tt
-
373 |
-
374 | ||| Declares `main : IO Unit` function that prints derived generator for the given generator's signature
-
375 | export
-
376 | deriveGenPrinter : {default True printTTImp : Bool} -> DerivatorCore => Type -> Elab Unit
-
377 | deriveGenPrinter ty = do
-
378 |   ty <- quote ty
-
379 |   logSugaredTerm "deptycheck.derive.print" DefaultLogLevel "type" ty
-
380 |   expr <- deriveGenExpr ty
-
381 |   expr <- quote expr
-
382 |   printTTImp <- quote printTTImp
-
383 |   declare `[
-
384 |     main : IO Unit
-
385 |     main = do
-
386 |       putStr $ if ~printTTImp then interpolate ~expr else show ~expr
-
387 |       putStrLn ""
-
388 |   ]
-
389 |
+
357 | ||| Since Idris allows simple top-level definitions to not to contain type signature,
+
358 | ||| one can use this derivation function as a one-liner without repetition of a desired type, e.g.
+
359 | |||
+
360 | |||   ```idris
+
361 | |||   genX = deriveGenFor $ Fuel -> (Fuel -> Gen Y) => (a : A) -> (c : C) -> Gen (b ** X a b c)
+
362 | |||   ```
+
363 | export %macro
+
364 | deriveGenFor : DerivatorCore => (0 a : Type) -> Elab a
+
365 | deriveGenFor a = do
+
366 |   sig <- quote a
+
367 |   tt <- deriveGenExpr sig
+
368 |   check tt
+
369 |
+
370 | ||| Declares `main : IO Unit` function that prints derived generator for the given generator's signature
+
371 | export
+
372 | deriveGenPrinter : {default True printTTImp : Bool} -> DerivatorCore => Type -> Elab Unit
+
373 | deriveGenPrinter ty = do
+
374 |   ty <- quote ty
+
375 |   logSugaredTerm "deptycheck.derive.print" DefaultLogLevel "type" ty
+
376 |   expr <- deriveGenExpr ty
+
377 |   expr <- quote expr
+
378 |   printTTImp <- quote printTTImp
+
379 |   declare `[
+
380 |     main : IO Unit
+
381 |     main = do
+
382 |       putStr $ if ~printTTImp then interpolate ~expr else show ~expr
+
383 |       putStrLn ""
+
384 |   ]
+
385 |
diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Logging.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Logging.html index f595d993b..6ae556f00 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Logging.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Logging.html @@ -61,4 +61,4 @@ -

Deriving.DepTyCheck.Util.Logging

(source)

Reexports

importpublic Data.So
importpublic Language.Reflection

Definitions

interfaceSingleLogPosition : Type->Type
Parameters: a
Methods:
logPosition : a->String

Implementations:
SingleLogPositionGenSignature
SingleLogPositionCon
logPosition : SingleLogPositiona=>a->String
Totality: total
Visibility: public export
dataLogPosition : Type
Totality: total
Visibility: public export
Constructors:
Nil : LogPosition
(::) : SingleLogPositiona=>a->LogPosition->LogPosition

Hint: 
InterpolationLogPosition
length : LogPosition->Nat
Totality: total
Visibility: export
DefaultLogLevel : Nat
Totality: total
Visibility: public export
logPoint : Elaborationm=> {defaultDefaultLogLevel_ : Nat} -> (subTopic : String) ->So (subTopic/=fromString"") =>LogPosition->String->m ()
Totality: total
Visibility: export
logBounds : Elaborationm=> {defaultDefaultLogLevel_ : Nat} -> (subTopic : String) ->So (subTopic/=fromString"") =>LogPosition->ma->ma
Totality: total
Visibility: export
+

Deriving.DepTyCheck.Util.Logging

(source)

Reexports

importpublic Data.So
importpublic Language.Reflection

Definitions

interfaceSingleLogPosition : Type->Type
Parameters: a
Methods:
logPosition : a->String

Implementations:
SingleLogPositionGenSignature
SingleLogPositionCon
logPosition : SingleLogPositiona=>a->String
Totality: total
Visibility: public export
dataLogPosition : Type
Totality: total
Visibility: public export
Constructors:
Nil : LogPosition
(::) : SingleLogPositiona=>a->LogPosition->LogPosition

Hint: 
InterpolationLogPosition
length : LogPosition->Nat
Totality: total
Visibility: export
DefaultLogLevel : Nat
Totality: total
Visibility: public export
logPoint : Elaborationm=> {defaultDefaultLogLevel_ : Nat} -> (subTopic : String) ->So (subTopic/=fromString"") =>LogPosition->String->m ()
Totality: total
Visibility: export
logBounds : Elaborationm=> {defaultDefaultLogLevel_ : Nat} -> (subTopic : String) ->So (subTopic/=fromString"") =>LogPosition->ma->ma
Totality: total
Visibility: export
diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Reflection.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Reflection.html index 3ae177844..1ee0edfc1 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Reflection.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Reflection.html @@ -62,4 +62,4 @@

Deriving.DepTyCheck.Util.Reflection

(source)
`Language.Reflection`-related utilities
-

Reexports

importpublic Control.Applicative.Const
importpublic Data.Alternative
importpublic Data.Fin.Lists
importpublic Data.Fin.ToFin
importpublic Data.Fuel
importpublic Data.Nat1
importpublic Data.List.Lazy
importpublic Data.List.Extra
importpublic Data.These
importpublic Data.Vect.Dependent
importpublic Data.Vect.Extra
importpublic Data.SortedMap
importpublic Data.SortedMap.Dependent
importpublic Data.SortedSet
importpublic Deriving.DepTyCheck.Util.Logging
importpublic Language.Reflection.Compat
importpublic Language.Reflection.TTImp
importpublic Language.Reflection.Pretty
importpublic Syntax.IHateParens.Function
importpublic Syntax.IHateParens.List
importpublic Syntax.IHateParens.SortedSet
importpublic Syntax.Monad.Logic
importpublic Text.PrettyPrint.Bernardy

Definitions

normaliseAsType : Elaborationm=>TTImp->mTTImp
Totality: total
Visibility: export
normaliseCon : Elaborationm=>Con->mCon
Totality: total
Visibility: export
isImplicit : PiInfoc->Bool
Totality: total
Visibility: public export
unDPair : TTImp-> (ListArg, TTImp)
Totality: total
Visibility: public export
unDPairUnAlt : TTImp->Maybe (ListArg, TTImp)
Totality: total
Visibility: public export
buildDPair : TTImp->List (Name, TTImp) ->TTImp
Totality: total
Visibility: public export
dataAnyApp : Type
Totality: total
Visibility: public export
Constructors:
PosApp : TTImp->AnyApp
NamedApp : Name->TTImp->AnyApp
AutoApp : TTImp->AnyApp
WithApp : TTImp->AnyApp
appArg : Arg->TTImp->AnyApp
Totality: total
Visibility: public export
getExpr : AnyApp->TTImp
Totality: total
Visibility: public export
mapExpr : (TTImp->TTImp) ->AnyApp->AnyApp
Totality: total
Visibility: public export
unAppAny : TTImp-> (TTImp, ListAnyApp)
Totality: total
Visibility: public export
reAppAny1 : TTImp->AnyApp->TTImp
Totality: total
Visibility: public export
reAppAny : Foldablef=>TTImp->fAnyApp->TTImp
Totality: total
Visibility: public export
appFuel : Name->TTImp->TTImp
Totality: total
Visibility: public export
liftList : Foldablef=>fTTImp->TTImp
Totality: total
Visibility: public export
liftWeight1 : TTImp
Totality: total
Visibility: export
dataCTLabel : Type
Totality: total
Visibility: public export
Constructor: 
MkCTLabel : TTImp->CTLabel

Hints:
FromStringCTLabel
MonoidCTLabel
SemigroupCTLabel
.label : String->CTLabel
Totality: total
Visibility: public export
.label : TTImp->CTLabel
Totality: total
Visibility: public export
labelGen : CTLabel->TTImp->TTImp
Totality: total
Visibility: export
callOneOf : CTLabel->ListTTImp->TTImp
Totality: total
Visibility: export
callFrequency : CTLabel->List (TTImp, TTImp) ->TTImp
Totality: total
Visibility: export
leftDepth : Fuel->Nat1
Totality: total
Visibility: public export
isSimpleBindVar : TTImp->Bool
Totality: total
Visibility: export
callCon : (con : Con) ->Vect ((con.args) .length) TTImp->TTImp
Totality: total
Visibility: export
outmostFuelArg : Name
Totality: total
Visibility: export
isNamespaced : Name->Bool
Totality: total
Visibility: export
typeInfoForPrimType : PrimType->TypeInfo
Totality: total
Visibility: export
typeInfoForTypeOfTypes : TypeInfo
Totality: total
Visibility: export
extractTargetTyExpr : TypeInfo->TTImp
Totality: total
Visibility: export
doesTypecheckAs : Elaborationm=> (0_ : Type) ->TTImp->mBool
Totality: total
Visibility: export
argDeps : Elaborationm=> (args : ListArg) ->m (DVect (args.length) (SortedSet. (Fin.finToNat)))
Totality: total
Visibility: export
deriveMatchingCons : TTImp-> (Con->TTImp) ->Name->TypeInfo->ListDecl
  Derives function `A -> B` where `A` is determined by the given `TypeInfo`, `B` is determined by `retTy`

For each constructor of `A` the `matcher` function is applied and its result (of type `B`) is used as a result.
Currently, `B` must be a non-dependent type.

Totality: total
Visibility: export
conSubexprs : Con->ListTTImp
Totality: total
Visibility: public export
ensureTyArgsNamed : Elaborationm=> (ty : TypeInfo) ->m (AllTyArgsNamedty)
Totality: total
Visibility: export
isSameTypeAs : Name->Name->ElabBool
Totality: total
Visibility: public export
nameConformsTo : Name->Name->Bool
Totality: total
Visibility: export
allVarNames' : TTImp->SortedSetName
Totality: total
Visibility: export
allVarNames : TTImp->ListName
Totality: total
Visibility: export
recordNamesInfoInTypes : Type
Totality: total
Visibility: export
Constructor: 
Names : SortedMapNameTypeInfo->SortedMapName (TypeInfo, Con) ->SortedMapTypeInfo (SortedSetName) ->NamesInfoInTypes

Projections:
.cons : NamesInfoInTypes->SortedMapName (TypeInfo, Con)
.namesInTypes : NamesInfoInTypes->SortedMapTypeInfo (SortedSetName)
.types : NamesInfoInTypes->SortedMapNameTypeInfo

Hints:
DerivatorCore=>ClojuringContextm=>Elaborationm=>NamesInfoInTypes=>CanonicGenm
MonoidNamesInfoInTypes
CanonicGenm->NamesInfoInTypes
SemigroupNamesInfoInTypes
lookupType : NamesInfoInTypes=>Name->MaybeTypeInfo
Totality: total
Visibility: export
lookupCon : NamesInfoInTypes=>Name->MaybeCon
Totality: total
Visibility: export
resolveNamesUniquely : NamesInfoInTypes=>SortedSetName->TTImp->Either (Name, SortedSetName) TTImp
  Returns either resolved expression, or a non-unique name and the set of alternatives.

Totality: total
Visibility: export
hasNameInsideDeep : NamesInfoInTypes=>Name->TTImp->Bool
Totality: total
Visibility: export
isRecursive : NamesInfoInTypes=>Con-> {defaultNothing_ : MaybeTypeInfo} ->Bool
Totality: total
Visibility: export
isRecursiveConstructor : NamesInfoInTypes=>Name->MaybeBool
Totality: total
Visibility: export
getNamesInfoInTypes : Elaborationm=>TypeInfo->mNamesInfoInTypes
Totality: total
Visibility: export
getNamesInfoInTypes' : Elaborationm=>TTImp->mNamesInfoInTypes
Totality: total
Visibility: export
isVar : TTImp->Bool
Totality: total
Visibility: public export
allInvolvedTypes : Elaborationm=>Count->TypeInfo->m (ListTypeInfo)
Totality: total
Visibility: export
genTypeName : (0_ : Type) ->ElabName
  Returns a name by the generator's type

Say, for the `Fuel -> Gen em (n ** Fin n)` it returns name of `Data.Fin.Fin`

Totality: total
Visibility: export
+

Reexports

importpublic Control.Applicative.Const
importpublic Data.Alternative
importpublic Data.Fin.Lists
importpublic Data.Fin.ToFin
importpublic Data.Fuel
importpublic Data.Nat1
importpublic Data.List.Lazy
importpublic Data.List.Extra
importpublic Data.These
importpublic Data.Vect.Dependent
importpublic Data.Vect.Extra
importpublic Data.SortedMap
importpublic Data.SortedMap.Dependent
importpublic Data.SortedSet
importpublic Deriving.DepTyCheck.Util.Logging
importpublic Language.Reflection.Compat
importpublic Language.Reflection.TTImp
importpublic Language.Reflection.Pretty
importpublic Syntax.IHateParens.Function
importpublic Syntax.IHateParens.List
importpublic Syntax.IHateParens.SortedSet
importpublic Syntax.Monad.Logic
importpublic Text.PrettyPrint.Bernardy

Definitions

normaliseAsType : Elaborationm=>TTImp->mTTImp
Totality: total
Visibility: export
normaliseCon : Elaborationm=>Con->mCon
Totality: total
Visibility: export
isImplicit : PiInfoc->Bool
Totality: total
Visibility: public export
unDPair : TTImp-> (ListArg, TTImp)
Totality: total
Visibility: public export
unDPairUnAlt : TTImp->Maybe (ListArg, TTImp)
Totality: total
Visibility: public export
buildDPair : TTImp->List (Name, TTImp) ->TTImp
Totality: total
Visibility: public export
dataAnyApp : Type
Totality: total
Visibility: public export
Constructors:
PosApp : TTImp->AnyApp
NamedApp : Name->TTImp->AnyApp
AutoApp : TTImp->AnyApp
WithApp : TTImp->AnyApp
appArg : Arg->TTImp->AnyApp
Totality: total
Visibility: public export
getExpr : AnyApp->TTImp
Totality: total
Visibility: public export
mapExpr : (TTImp->TTImp) ->AnyApp->AnyApp
Totality: total
Visibility: public export
unAppAny : TTImp-> (TTImp, ListAnyApp)
Totality: total
Visibility: public export
reAppAny1 : TTImp->AnyApp->TTImp
Totality: total
Visibility: public export
reAppAny : Foldablef=>TTImp->fAnyApp->TTImp
Totality: total
Visibility: public export
appFuel : Name->TTImp->TTImp
Totality: total
Visibility: public export
liftList : Foldablef=>fTTImp->TTImp
Totality: total
Visibility: public export
liftWeight1 : TTImp
Totality: total
Visibility: export
dataCTLabel : Type
Totality: total
Visibility: public export
Constructor: 
MkCTLabel : TTImp->CTLabel

Hints:
FromStringCTLabel
MonoidCTLabel
SemigroupCTLabel
.label : String->CTLabel
Totality: total
Visibility: public export
.label : TTImp->CTLabel
Totality: total
Visibility: public export
labelGen : CTLabel->TTImp->TTImp
Totality: total
Visibility: export
callOneOf : CTLabel->ListTTImp->TTImp
Totality: total
Visibility: export
callFrequency : CTLabel->List (TTImp, TTImp) ->TTImp
Totality: total
Visibility: export
leftDepth : Fuel->Nat1
Totality: total
Visibility: public export
isSimpleBindVar : TTImp->Bool
Totality: total
Visibility: export
callCon : (con : Con) ->Vect ((con.args) .length) TTImp->TTImp
Totality: total
Visibility: export
outmostFuelArg : Name
Totality: total
Visibility: export
isNamespaced : Name->Bool
Totality: total
Visibility: export
typeInfoForPrimType : PrimType->TypeInfo
Totality: total
Visibility: export
typeInfoForTypeOfTypes : TypeInfo
Totality: total
Visibility: export
extractTargetTyExpr : TypeInfo->TTImp
Totality: total
Visibility: export
deriveMatchingCons : TTImp-> (Con->TTImp) ->Name->TypeInfo->ListDecl
  Derives function `A -> B` where `A` is determined by the given `TypeInfo`, `B` is determined by `retTy`

For each constructor of `A` the `matcher` function is applied and its result (of type `B`) is used as a result.
Currently, `B` must be a non-dependent type.

Totality: total
Visibility: export
conSubexprs : Con->ListTTImp
Totality: total
Visibility: public export
ensureTyArgsNamed : Elaborationm=> (ty : TypeInfo) ->m (AllTyArgsNamedty)
Totality: total
Visibility: export
isSameTypeAs : Name->Name->ElabBool
Totality: total
Visibility: public export
nameConformsTo : Name->Name->Bool
Totality: total
Visibility: export
allVarNames' : TTImp->SortedSetName
Totality: total
Visibility: export
allVarNames : TTImp->ListName
Totality: total
Visibility: export
recordNamesInfoInTypes : Type
Totality: total
Visibility: export
Constructor: 
Names : SortedMapNameTypeInfo->SortedMapName (TypeInfo, Con) ->SortedMapTypeInfo (SortedSetName) ->NamesInfoInTypes

Projections:
.cons : NamesInfoInTypes->SortedMapName (TypeInfo, Con)
.namesInTypes : NamesInfoInTypes->SortedMapTypeInfo (SortedSetName)
.types : NamesInfoInTypes->SortedMapNameTypeInfo

Hints:
DerivatorCore=>ClojuringContextm=>Elaborationm=>NamesInfoInTypes=>CanonicGenm
MonoidNamesInfoInTypes
CanonicGenm->NamesInfoInTypes
SemigroupNamesInfoInTypes
lookupType : NamesInfoInTypes=>Name->MaybeTypeInfo
Totality: total
Visibility: export
lookupCon : NamesInfoInTypes=>Name->MaybeCon
Totality: total
Visibility: export
resolveNamesUniquely : NamesInfoInTypes=>SortedSetName->TTImp->Either (Name, SortedSetName) TTImp
  Returns either resolved expression, or a non-unique name and the set of alternatives.

Totality: total
Visibility: export
hasNameInsideDeep : NamesInfoInTypes=>Name->TTImp->Bool
Totality: total
Visibility: export
isRecursive : NamesInfoInTypes=>Con-> {defaultNothing_ : MaybeTypeInfo} ->Bool
Totality: total
Visibility: export
isRecursiveConstructor : NamesInfoInTypes=>Name->MaybeBool
Totality: total
Visibility: export
getNamesInfoInTypes : Elaborationm=>TypeInfo->mNamesInfoInTypes
Totality: total
Visibility: export
getNamesInfoInTypes' : Elaborationm=>TTImp->mNamesInfoInTypes
Totality: total
Visibility: export
isVar : TTImp->Bool
Totality: total
Visibility: public export
allInvolvedTypes : Elaborationm=>Count->TypeInfo->m (ListTypeInfo)
Totality: total
Visibility: export
genTypeName : (0_ : Type) ->ElabName
  Returns a name by the generator's type

Say, for the `Fuel -> Gen em (n ** Fin n)` it returns name of `Data.Fin.Fin`

Totality: total
Visibility: export
argDeps : (args : ListArg) ->DVect (args.length) (SortedSet. (Fin.finToNat))
Totality: total
Visibility: export
diff --git a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Reflection.src.html b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Reflection.src.html index a12d9dcdc..3a4aa0209 100644 --- a/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Reflection.src.html +++ b/docs/deptycheck/docs/docs/Deriving.DepTyCheck.Util.Reflection.src.html @@ -436,402 +436,315 @@
315 | typeCon : TypeInfo -> Con
316 | typeCon ti = MkCon ti.name ti.args type
317 |
-
318 | ----------------------------------------------
-
319 | --- Analyzing dependently typed signatures ---
-
320 | ----------------------------------------------
+
318 | ------------------------------------
+
319 | --- Analysis of type definitions ---
+
320 | ------------------------------------
321 |
-
322 | export
-
323 | doesTypecheckAs : Elaboration m => (0 expected : Type) -> TTImp -> m Bool
-
324 | doesTypecheckAs expected expr = try .| check {expected} expr $> True .| pure False
-
325 |
+
322 | ||| Derives function `A -> B` where `A` is determined by the given `TypeInfo`, `B` is determined by `retTy`
+
323 | |||
+
324 | ||| For each constructor of `A` the `matcher` function is applied and its result (of type `B`) is used as a result.
+
325 | ||| Currently, `B` must be a non-dependent type.
326 | export
-
327 | argDeps : Elaboration m => (args : List Arg) -> m $ DVect args.length $ SortedSet . Fin . Fin.finToNat
-
328 | argDeps args = do
-
329 |   ignore $ check {expected=Type} $ fullSig defaultRet -- we can't return trustful result if given arguments do not form a nice Pi type
-
330 |   concatMap depsOfOne range
-
331 |
-
332 |   where
-
333 |
-
334 |   %unbound_implicits off -- this is a workaround of https://github.com/idris-lang/Idris2/issues/2040
-
335 |
-
336 |   filteredArgs : (excluded : SortedSet $ Fin args.length) -> List Arg
-
337 |   filteredArgs excluded = filterI args $ \idx, _ => not $ contains idx excluded
-
338 |
-
339 |   partialSig : (retTy : TTImp) -> (excluded : SortedSet $ Fin args.length) -> TTImp
-
340 |   partialSig retTy = piAll retTy . map {piInfo := ExplicitArg} . filteredArgs
+
327 | deriveMatchingCons : (retTy : TTImp) -> (matcher : Con -> TTImp) -> (funName : Name) -> TypeInfo -> List Decl
+
328 | deriveMatchingCons retTy matcher funName ti = do
+
329 |   let claim = do
+
330 |     let tyApplied = reAppAny (var ti.name) $ ti.args <&> \arg => appArg arg $ var $ argName arg
+
331 |     let sig = foldr
+
332 |                 (pi . {count := M0, piInfo := ImplicitArg})
+
333 |                 `(~tyApplied -> ~retTy)
+
334 |                 ti.args
+
335 |     private' funName sig
+
336 |   let body = do
+
337 |     let matchCon = \con => reAppAny (var con.name) $ con.args <&> flip appArg implicitTrue
+
338 |     def funName $ ti.cons <&> \con =>
+
339 |       patClause (var funName .$ matchCon con) $ matcher con
+
340 |   [claim, body]
341 |
-
342 |   partialApp : (appliee : Name) -> (excluded : SortedSet $ Fin args.length) -> TTImp
-
343 |   partialApp n = appNames n . map argName . filteredArgs
-
344 |
-
345 |   fullSig : (retTy : TTImp) -> TTImp
-
346 |   fullSig t = partialSig t empty
-
347 |
-
348 |   fullApp : (appliee : Name) -> TTImp
-
349 |   fullApp n = partialApp n empty
-
350 |
-
351 |   defaultRet : TTImp
-
352 |   defaultRet = `(Builtin.Unit)
-
353 |
-
354 |   -- This is for check that *meaning* of types are preversed after excluding some of arguments
-
355 |   --
-
356 |   -- Example:
-
357 |   --   Consider that `args` form the following: `(n : Nat) -> (a : Type) -> (v : Vect n a) -> (x : Nat) -> ...`
-
358 |   --   Consider we have `excluded` set containing only index 3 (the `x : Nat` argument).
-
359 |   --   For this case this function would return the following type:
-
360 |   --   ```
-
361 |   --     (full : (n : Nat) -> (a : Type) -> (v : Vect n a) -> (x : Nat) -> Unit) ->
-
362 |   --     (part : (n : Nat) -> (a : Type) -> (v : Vect n a) -> Unit) ->
-
363 |   --     (n : Nat) -> (a : Type) -> (v : Vect n a) -> (x : Nat) ->
-
364 |   --     full n a v x = part n a v
-
365 |   --   ```
-
366 |   --   As soon as this expression typechecks as `Type`, we are confident that
-
367 |   --   corresponding parameters of the full and the partial signatures are compatible, i.e.
-
368 |   --   removing of the parameters from `excluded` set does not change left types too much.
-
369 |   preservationCheckSig : (excluded : SortedSet $ Fin args.length) -> TTImp
-
370 |   preservationCheckSig excluded =
-
371 |     pi (MkArg MW ExplicitArg .| Just full .| fullSig defaultRet) $
-
372 |     pi (MkArg MW ExplicitArg .| Just part .| partialSig defaultRet excluded) $
-
373 |     fullSig $
-
374 |     `(Builtin.Equal) .$ fullApp full .$ partialApp part excluded
-
375 |     where
-
376 |       full, part : Name
-
377 |       full = MN "full" 1
-
378 |       part = MN "part" 1
-
379 |
-
380 |   checkExcluded : (excluded : SortedSet $ Fin args.length) -> m Bool
-
381 |   checkExcluded excluded = doesTypecheckAs Type (partialSig defaultRet excluded)
-
382 |                         && doesTypecheckAs Type (preservationCheckSig excluded)
-
383 |
-
384 |   -- Returns a set of indices of all arguments that do depend on the given
-
385 |   depsOfOne' : (idx : Fin args.length) -> m $ SortedSet $ Fin args.length
-
386 |   depsOfOne' idx = do
-
387 |     let cands = allGreaterThan idx
-
388 |     findMinExclude cands $ fromList cands
-
389 |
-
390 |     where
-
391 |       -- tries to add candidates one by one, and leave them if typechecks without the current `idx`
-
392 |       findMinExclude : (left : List $ Fin args.length) -> (currExcl : SortedSet $ Fin args.length) -> m $ SortedSet $ Fin args.length
-
393 |       findMinExclude [] excl = pure excl
-
394 |       findMinExclude (x::xs) prevExcl = do
-
395 |         let currExcl = delete x prevExcl
-
396 |         findMinExclude xs $ if !(checkExcluded $ insert idx currExcl) then currExcl else prevExcl
+
342 | public export
+
343 | conSubexprs : Con -> List TTImp
+
344 | conSubexprs con = map type con.args ++ (map getExpr $ snd $ unAppAny con.type)
+
345 |
+
346 | export
+
347 | ensureTyArgsNamed : Elaboration m => (ty : TypeInfo) -> m $ AllTyArgsNamed ty
+
348 | ensureTyArgsNamed ty = do
+
349 |   let Yes prf = areAllTyArgsNamed ty
+
350 |     | No _ => fail "DepTyCheck blames the compiler: type info for type `\{ty.name}` contains unnamed arguments"
+
351 |   pure prf
+
352 |
+
353 | -------------------------------------------------
+
354 | --- Syntactic analysis of `TTImp` expressions ---
+
355 | -------------------------------------------------
+
356 |
+
357 | -- fails is given names are not types
+
358 | public export
+
359 | isSameTypeAs : Name -> Name -> Elab Bool
+
360 | isSameTypeAs checked expected = let eq = (==) `on` name in [| getInfo' checked `eq` getInfo' expected |]
+
361 |
+
362 | export
+
363 | nameConformsTo : (cand, origin : Name) -> Bool
+
364 | nameConformsTo cand origin = do
+
365 |   let (cns, cn) = simplify cand
+
366 |   let (ons, on) = simplify origin
+
367 |   cn == on && (cns `isPrefixOf` ons) -- notice that namespaces are stored in the reverse order
+
368 |   where
+
369 |     simplify : Name -> (List String, Name)
+
370 |     simplify (NS (MkNS ns) nm) = mapFst (++ ns) $ simplify nm
+
371 |     simplify (DN _ nm)         = simplify nm
+
372 |     simplify x                 = ([], x)
+
373 |
+
374 | 0 nct_corr_eq : nameConformsTo `{A.B.c} `{A.B.c} = True;  nct_corr_eq = Refl
+
375 | 0 nct_corr_le : nameConformsTo `{B.c}   `{A.B.c} = True;  nct_corr_le = Refl
+
376 | 0 nct_corr_ge : nameConformsTo `{A.B.c} `{B.c}   = Falsenct_corr_ge = Refl
+
377 |
+
378 | -- simple syntactic search of a `IVar`, disregarding shadowing or whatever
+
379 | export
+
380 | allVarNames' : TTImp -> SortedSet Name
+
381 | allVarNames' = runConst . mapATTImp' f where
+
382 |   f : TTImp -> Const (SortedSet Name) TTImp -> Const (SortedSet Name) TTImp
+
383 |   f (IVar _ n) = const $ MkConst $ singleton n
+
384 |   f _          = id
+
385 |
+
386 | -- Same as `allVarNames'`, but returning `List`
+
387 | export
+
388 | allVarNames : TTImp -> List Name
+
389 | allVarNames = SortedSet.toList . allVarNames'
+
390 |
+
391 | export
+
392 | record NamesInfoInTypes where
+
393 |   constructor Names
+
394 |   types : SortedMap Name TypeInfo
+
395 |   cons  : SortedMap Name (TypeInfo, Con)
+
396 |   namesInTypes : SortedMap TypeInfo $ SortedSet Name
397 |
-
398 |   depsOfOne : Fin args.length -> m $ DVect args.length $ SortedSet . Fin . Fin.finToNat
-
399 |   depsOfOne idx = do
-
400 |     whoDependsOnIdx <- depsOfOne' idx
-
401 |     sequence $ tabulateI $ \i =>
-
402 |       if contains i whoDependsOnIdx
-
403 |       then do
-
404 |         let Just dep = tryToFit idx
-
405 |           | Nothing => fail "INTERNAL ERROR: unable to fit fins during dependency calculation"
-
406 |         pure $ singleton dep
-
407 |       else pure empty
-
408 |
-
409 |   %unbound_implicits on -- this is a workaround of https://github.com/idris-lang/Idris2/issues/2039
+
398 | lookupByType : NamesInfoInTypes => Name -> Maybe $ SortedSet Name
+
399 | lookupByType @{tyi} = lookup' tyi.types >=> lookup' tyi.namesInTypes
+
400 |
+
401 | lookupByCon : NamesInfoInTypes => Name -> Maybe $ SortedSet Name
+
402 | lookupByCon @{tyi} = concatMap @{Deep} lookupByType . SortedSet.toList . concatMap allVarNames' . conSubexprs . snd <=< lookup' tyi.cons
+
403 |
+
404 | typeByCon : NamesInfoInTypes => Con -> Maybe TypeInfo
+
405 | typeByCon @{tyi} = map fst . lookup' tyi.cons . name
+
406 |
+
407 | export
+
408 | lookupType : NamesInfoInTypes => Name -> Maybe TypeInfo
+
409 | lookupType @{tyi} = lookup' tyi.types
410 |
-
411 |   Semigroup a => Applicative f => Semigroup (f a) where
-
412 |     a <+> b = [| a <+> b |]
-
413 |
-
414 |   Monoid a => Applicative f => Monoid (f a) where
-
415 |     neutral = pure neutral
-
416 |
-
417 | ------------------------------------
-
418 | --- Analysis of type definitions ---
-
419 | ------------------------------------
-
420 |
-
421 | ||| Derives function `A -> B` where `A` is determined by the given `TypeInfo`, `B` is determined by `retTy`
-
422 | |||
-
423 | ||| For each constructor of `A` the `matcher` function is applied and its result (of type `B`) is used as a result.
-
424 | ||| Currently, `B` must be a non-dependent type.
-
425 | export
-
426 | deriveMatchingCons : (retTy : TTImp) -> (matcher : Con -> TTImp) -> (funName : Name) -> TypeInfo -> List Decl
-
427 | deriveMatchingCons retTy matcher funName ti = do
-
428 |   let claim = do
-
429 |     let tyApplied = reAppAny (var ti.name) $ ti.args <&> \arg => appArg arg $ var $ argName arg
-
430 |     let sig = foldr
-
431 |                 (pi . {count := M0, piInfo := ImplicitArg})
-
432 |                 `(~tyApplied -> ~retTy)
-
433 |                 ti.args
-
434 |     private' funName sig
-
435 |   let body = do
-
436 |     let matchCon = \con => reAppAny (var con.name) $ con.args <&> flip appArg implicitTrue
-
437 |     def funName $ ti.cons <&> \con =>
-
438 |       patClause (var funName .$ matchCon con) $ matcher con
-
439 |   [claim, body]
+
411 | export
+
412 | lookupCon : NamesInfoInTypes => Name -> Maybe Con
+
413 | lookupCon @{tyi} n = snd <$> lookup n tyi.cons
+
414 |                  <|> typeCon <$> lookup n tyi.types
+
415 |
+
416 | ||| Returns either resolved expression, or a non-unique name and the set of alternatives.
+
417 | -- We could use `Validated (SortedMap Name $ SortedSet Name) TTImp` as the result, if we depended on `contrib`.
+
418 | -- NOTICE: this function does not resolve re-export aliases, say, it does not resolve `Prelude.Nil` to `Prelude.Basics.Nil`.
+
419 | export
+
420 | resolveNamesUniquely : NamesInfoInTypes => (freeNames : SortedSet Name) -> TTImp -> Either (Name, SortedSet Name) TTImp
+
421 | resolveNamesUniquely @{tyi} freeNames = do
+
422 |   let allConsideredNames = keySet tyi.types `union` keySet tyi.cons
+
423 |   let reverseNamesMap = concatMap (uncurry SortedMap.singleton) $ allConsideredNames.asList >>= \n => allNameSuffixes n <&> (, SortedSet.singleton n)
+
424 |   mapATTImp' $ \case
+
425 |     v@(IVar fc n) => if contains n freeNames then id else do
+
426 |                        let Just resolvedAlts = lookup n reverseNamesMap | Nothing => id
+
427 |                        let [resolved] = SortedSet.toList resolvedAlts
+
428 |                          | _ => const $ Left (n, resolvedAlts)
+
429 |                        const $ pure $ IVar fc resolved
+
430 |     _ => id
+
431 |
+
432 | Semigroup NamesInfoInTypes where
+
433 |   Names ts cs nit <+> Names ts' cs' nit' = Names (ts `mergeLeft` ts') (cs `mergeLeft` cs') (nit <+> nit')
+
434 |
+
435 | Eq TypeInfo where (==) = (==) `on` name
+
436 | Ord TypeInfo where compare = comparing name
+
437 |
+
438 | Monoid NamesInfoInTypes where
+
439 |   neutral = Names empty empty empty
440 |
-
441 | public export
-
442 | conSubexprs : Con -> List TTImp
-
443 | conSubexprs con = map type con.args ++ (map getExpr $ snd $ unAppAny con.type)
+
441 | export
+
442 | hasNameInsideDeep : NamesInfoInTypes => Name -> TTImp -> Bool
+
443 | hasNameInsideDeep @{tyi} nm = hasInside empty . allVarNames where
444 |
-
445 | export
-
446 | ensureTyArgsNamed : Elaboration m => (ty : TypeInfo) -> m $ AllTyArgsNamed ty
-
447 | ensureTyArgsNamed ty = do
-
448 |   let Yes prf = areAllTyArgsNamed ty
-
449 |     | No _ => fail "DepTyCheck blames the compiler: type info for type `\{ty.name}` contains unnamed arguments"
-
450 |   pure prf
+
445 |   hasInside : (visited : SortedSet Name) -> (toLook : List Name) -> Bool
+
446 |   hasInside visited []           = False
+
447 |   hasInside visited (curr::rest) = if curr == nm then True else do
+
448 |     let new = if contains curr visited then [] else maybe [] SortedSet.toList $ lookupByType curr
+
449 |     -- visited is limited and either growing or `new` is empty, thus `toLook` is strictly less
+
450 |     assert_total $ hasInside (insert curr visited) (new ++ rest)
451 |
-
452 | -------------------------------------------------
-
453 | --- Syntactic analysis of `TTImp` expressions ---
-
454 | -------------------------------------------------
-
455 |
-
456 | -- fails is given names are not types
-
457 | public export
-
458 | isSameTypeAs : Name -> Name -> Elab Bool
-
459 | isSameTypeAs checked expected = let eq = (==) `on` name in [| getInfo' checked `eq` getInfo' expected |]
-
460 |
-
461 | export
-
462 | nameConformsTo : (cand, origin : Name) -> Bool
-
463 | nameConformsTo cand origin = do
-
464 |   let (cns, cn) = simplify cand
-
465 |   let (ons, on) = simplify origin
-
466 |   cn == on && (cns `isPrefixOf` ons) -- notice that namespaces are stored in the reverse order
-
467 |   where
-
468 |     simplify : Name -> (List String, Name)
-
469 |     simplify (NS (MkNS ns) nm) = mapFst (++ ns) $ simplify nm
-
470 |     simplify (DN _ nm)         = simplify nm
-
471 |     simplify x                 = ([], x)
-
472 |
-
473 | 0 nct_corr_eq : nameConformsTo `{A.B.c} `{A.B.c} = True;  nct_corr_eq = Refl
-
474 | 0 nct_corr_le : nameConformsTo `{B.c}   `{A.B.c} = True;  nct_corr_le = Refl
-
475 | 0 nct_corr_ge : nameConformsTo `{A.B.c} `{B.c}   = Falsenct_corr_ge = Refl
-
476 |
-
477 | -- simple syntactic search of a `IVar`, disregarding shadowing or whatever
-
478 | export
-
479 | allVarNames' : TTImp -> SortedSet Name
-
480 | allVarNames' = runConst . mapATTImp' f where
-
481 |   f : TTImp -> Const (SortedSet Name) TTImp -> Const (SortedSet Name) TTImp
-
482 |   f (IVar _ n) = const $ MkConst $ singleton n
-
483 |   f _          = id
-
484 |
-
485 | -- Same as `allVarNames'`, but returning `List`
+
452 | export
+
453 | isRecursive : NamesInfoInTypes => (con : Con) -> {default Nothing containingType : Maybe TypeInfo} -> Bool
+
454 | isRecursive con = case the (Maybe TypeInfo) $ containingType <|> typeByCon con of
+
455 |   Just containingType => any (hasNameInsideDeep containingType.name) $ conSubexprs con
+
456 |   Nothing             => False
+
457 |
+
458 | -- returns `Nothing` if given name is not a constructor
+
459 | export
+
460 | isRecursiveConstructor : NamesInfoInTypes => Name -> Maybe Bool
+
461 | isRecursiveConstructor @{tyi} n = lookup' tyi.cons n <&> \(ty, con) => isRecursive {containingType=Just ty} con
+
462 |
+
463 | export
+
464 | getNamesInfoInTypes : Elaboration m => TypeInfo -> m NamesInfoInTypes
+
465 | getNamesInfoInTypes ty = go neutral [ty]
+
466 |   where
+
467 |
+
468 |     subexprs : TypeInfo -> List TTImp
+
469 |     subexprs ty = map type ty.args ++ (ty.cons >>= conSubexprs)
+
470 |
+
471 |     go : NamesInfoInTypes -> List TypeInfo -> m NamesInfoInTypes
+
472 |     go tyi []         = pure tyi
+
473 |     go tyi (ti::rest) = do
+
474 |       ti <- normaliseCons ti
+
475 |       let subes = concatMap allVarNames' $ subexprs ti
+
476 |       new <- map join $ for (SortedSet.toList subes) $ \n =>
+
477 |                if isNothing $ lookupByType n
+
478 |                  then map toList $ catch $ getInfo' n
+
479 |                  else pure []
+
480 |       let next = { types $= insert ti.name ti
+
481 |                  , namesInTypes $= insert ti subes
+
482 |                  , cons $= mergeLeft $ fromList $ ti.cons <&> \con => (con.name, ti, con)
+
483 |                  } tyi
+
484 |       assert_total $ go next (new ++ rest)
+
485 |
486 | export
-
487 | allVarNames : TTImp -> List Name
-
488 | allVarNames = SortedSet.toList . allVarNames'
-
489 |
-
490 | export
-
491 | record NamesInfoInTypes where
-
492 |   constructor Names
-
493 |   types : SortedMap Name TypeInfo
-
494 |   cons  : SortedMap Name (TypeInfo, Con)
-
495 |   namesInTypes : SortedMap TypeInfo $ SortedSet Name
-
496 |
-
497 | lookupByType : NamesInfoInTypes => Name -> Maybe $ SortedSet Name
-
498 | lookupByType @{tyi} = lookup' tyi.types >=> lookup' tyi.namesInTypes
-
499 |
-
500 | lookupByCon : NamesInfoInTypes => Name -> Maybe $ SortedSet Name
-
501 | lookupByCon @{tyi} = concatMap @{Deep} lookupByType . SortedSet.toList . concatMap allVarNames' . conSubexprs . snd <=< lookup' tyi.cons
+
487 | getNamesInfoInTypes' : Elaboration m => TTImp -> m NamesInfoInTypes
+
488 | getNamesInfoInTypes' expr = do
+
489 |   let varsFirstOrder = allVarNames expr
+
490 |   varsSecondOrder <- map concat $ Prelude.for varsFirstOrder $ \n => do
+
491 |                        ns <- getType n
+
492 |                        pure $ SortedSet.insert n $ flip concatMap ns $ \(n', ty) => insert n' $ allVarNames' ty
+
493 |   tys <- map (mapMaybe id) $ for (SortedSet.toList varsSecondOrder) $ catch . getInfo'
+
494 |   concat <$> Prelude.for tys getNamesInfoInTypes
+
495 |
+
496 | public export
+
497 | isVar : TTImp -> Bool
+
498 | isVar $ IVar {} = True
+
499 | isVar _         = False
+
500 |
+
501 | namespace UpToRenaming
502 |
-
503 | typeByCon : NamesInfoInTypes => Con -> Maybe TypeInfo
-
504 | typeByCon @{tyi} = map fst . lookup' tyi.cons . name
-
505 |
-
506 | export
-
507 | lookupType : NamesInfoInTypes => Name -> Maybe TypeInfo
-
508 | lookupType @{tyi} = lookup' tyi.types
-
509 |
-
510 | export
-
511 | lookupCon : NamesInfoInTypes => Name -> Maybe Con
-
512 | lookupCon @{tyi} n = snd <$> lookup n tyi.cons
-
513 |                  <|> typeCon <$> lookup n tyi.types
-
514 |
-
515 | ||| Returns either resolved expression, or a non-unique name and the set of alternatives.
-
516 | -- We could use `Validated (SortedMap Name $ SortedSet Name) TTImp` as the result, if we depended on `contrib`.
-
517 | -- NOTICE: this function does not resolve re-export aliases, say, it does not resolve `Prelude.Nil` to `Prelude.Basics.Nil`.
-
518 | export
-
519 | resolveNamesUniquely : NamesInfoInTypes => (freeNames : SortedSet Name) -> TTImp -> Either (Name, SortedSet Name) TTImp
-
520 | resolveNamesUniquely @{tyi} freeNames = do
-
521 |   let allConsideredNames = keySet tyi.types `union` keySet tyi.cons
-
522 |   let reverseNamesMap = concatMap (uncurry SortedMap.singleton) $ allConsideredNames.asList >>= \n => allNameSuffixes n <&> (, SortedSet.singleton n)
-
523 |   mapATTImp' $ \case
-
524 |     v@(IVar fc n) => if contains n freeNames then id else do
-
525 |                        let Just resolvedAlts = lookup n reverseNamesMap | Nothing => id
-
526 |                        let [resolved] = SortedSet.toList resolvedAlts
-
527 |                          | _ => const $ Left (n, resolvedAlts)
-
528 |                        const $ pure $ IVar fc resolved
-
529 |     _ => id
-
530 |
-
531 | Semigroup NamesInfoInTypes where
-
532 |   Names ts cs nit <+> Names ts' cs' nit' = Names (ts `mergeLeft` ts') (cs `mergeLeft` cs') (nit <+> nit')
-
533 |
-
534 | Eq TypeInfo where (==) = (==) `on` name
-
535 | Ord TypeInfo where compare = comparing name
-
536 |
-
537 | Monoid NamesInfoInTypes where
-
538 |   neutral = Names empty empty empty
-
539 |
-
540 | export
-
541 | hasNameInsideDeep : NamesInfoInTypes => Name -> TTImp -> Bool
-
542 | hasNameInsideDeep @{tyi} nm = hasInside empty . allVarNames where
-
543 |
-
544 |   hasInside : (visited : SortedSet Name) -> (toLook : List Name) -> Bool
-
545 |   hasInside visited []           = False
-
546 |   hasInside visited (curr::rest) = if curr == nm then True else do
-
547 |     let new = if contains curr visited then [] else maybe [] SortedSet.toList $ lookupByType curr
-
548 |     -- visited is limited and either growing or `new` is empty, thus `toLook` is strictly less
-
549 |     assert_total $ hasInside (insert curr visited) (new ++ rest)
+
503 |   mutual
+
504 |
+
505 |     compWithSubst : (subst : List $ These Name Name) => (from, to : Maybe Name) -> TTImp -> TTImp -> Bool
+
506 |     compWithSubst (Just n) (Just n') e e' = n == n' && (e == e') @{UpToSubst} || (e == e') @{UpToSubst @{Both n n' :: subst}}
+
507 |     compWithSubst (Just n) Nothing   e e' = (e == e') @{UpToSubst @{This n  :: subst}}
+
508 |     compWithSubst Nothing  (Just n') e e' = (e == e') @{UpToSubst @{That n' :: subst}}
+
509 |     compWithSubst Nothing  Nothing   e e' = (e == e') @{UpToSubst}
+
510 |
+
511 |     [UpToSubst] (subst : List $ These Name Name) => Eq TTImp where
+
512 |       IVar _ v == IVar _ v' = maybe (v == v') (== Both v v') $ flip find subst $ \ior => fromThis ior == Just v || fromThat ior == Just v'
+
513 |       IPi _ c i n a r == IPi _ c' i' n' a' r' =
+
514 |         c == c' && (assert_total $ i == i') && a == a' && (assert_total $ compWithSubst n n' r r')
+
515 |       ILam _ c i n a r == ILam _ c' i' n' a' r' =
+
516 |         c == c' && (assert_total $ i == i') && a == a' && (assert_total $ compWithSubst n n' r r')
+
517 |       ILet _ _ c n ty val s == ILet _ _ c' n' ty' val' s' =
+
518 |         c == c' && ty == ty' && val == val' && (assert_total $ compWithSubst (Just n) (Just n') s s')
+
519 |
+
520 |       ICase _ os t ty cs == ICase _ os' t' ty' cs' =
+
521 |         t == t' && (assert_total $ os == os') && ty == ty' && (assert_total $ cs == cs')
+
522 |       ILocal _ ds e == ILocal _ ds' e' =
+
523 |         (assert_total $ ds == ds') && e == e'
+
524 |       IUpdate _ fs t == IUpdate _ fs' t' =
+
525 |         (assert_total $ fs == fs') && t == t'
+
526 |
+
527 |       IApp _ f x == IApp _ f' x' = f == f' && x == x'
+
528 |       INamedApp _ f n x == INamedApp _ f' n' x' =
+
529 |         f == f' && n == n' && x == x'
+
530 |       IAutoApp _ f x == IAutoApp _ f' x' = f == f' && x == x'
+
531 |       IWithApp _ f x == IWithApp _ f' x' = f == f' && x == x'
+
532 |
+
533 |       ISearch _ n == ISearch _ n' = n == n'
+
534 |       IAlternative _ t as == IAlternative _ t' as' =
+
535 |         (assert_total $ t == t') && (assert_total $ as == as')
+
536 |       IRewrite _ p q == IRewrite _ p' q' =
+
537 |         p == p' && q == q'
+
538 |
+
539 |       IBindHere _ m t == IBindHere _ m' t' =
+
540 |         m == m' && t == t'
+
541 |       IBindVar _ s == IBindVar _ s' = s == s'
+
542 |       IAs _ _ u n t == IAs _ _ u' n' t' =
+
543 |         u == u' && n == n' && t == t'
+
544 |       IMustUnify _ r t == IMustUnify _ r' t' =
+
545 |         r == r' && t == t'
+
546 |
+
547 |       IDelayed _ r t == IDelayed _ r' t' = r == r' && t == t'
+
548 |       IDelay _ t == IDelay _ t' = t == t'
+
549 |       IForce _ t == IForce _ t' = t == t'
550 |
-
551 | export
-
552 | isRecursive : NamesInfoInTypes => (con : Con) -> {default Nothing containingType : Maybe TypeInfo} -> Bool
-
553 | isRecursive con = case the (Maybe TypeInfo) $ containingType <|> typeByCon con of
-
554 |   Just containingType => any (hasNameInsideDeep containingType.name) $ conSubexprs con
-
555 |   Nothing             => False
-
556 |
-
557 | -- returns `Nothing` if given name is not a constructor
-
558 | export
-
559 | isRecursiveConstructor : NamesInfoInTypes => Name -> Maybe Bool
-
560 | isRecursiveConstructor @{tyi} n = lookup' tyi.cons n <&> \(ty, con) => isRecursive {containingType=Just ty} con
-
561 |
-
562 | export
-
563 | getNamesInfoInTypes : Elaboration m => TypeInfo -> m NamesInfoInTypes
-
564 | getNamesInfoInTypes ty = go neutral [ty]
-
565 |   where
-
566 |
-
567 |     subexprs : TypeInfo -> List TTImp
-
568 |     subexprs ty = map type ty.args ++ (ty.cons >>= conSubexprs)
+
551 |       IQuote _ tm == IQuote _ tm' = tm == tm'
+
552 |       IQuoteName _ n == IQuoteName _ n' = n == n'
+
553 |       IQuoteDecl _ ds == IQuoteDecl _ ds' = assert_total $ ds == ds'
+
554 |       IUnquote _ tm == IUnquote _ tm' = tm == tm'
+
555 |
+
556 |       IPrimVal _ c == IPrimVal _ c' = c == c'
+
557 |       IType _ == IType _ = True
+
558 |       IHole _ s == IHole _ s' = True -- Holes are anyway unique and does not matter what the names are.
+
559 |
+
560 |       Implicit _ b == Implicit _ b' = b == b'
+
561 |       IWithUnambigNames _ ns t == IWithUnambigNames _ ns' t' =
+
562 |         map snd ns == map snd ns' && t == t'
+
563 |
+
564 |       _ == _ = False
+
565 |
+
566 |   export
+
567 |   [UpToRenaming] Eq TTImp where
+
568 |     x == y = (x == y) @{UpToSubst @{empty}}
569 |
-
570 |     go : NamesInfoInTypes -> List TypeInfo -> m NamesInfoInTypes
-
571 |     go tyi []         = pure tyi
-
572 |     go tyi (ti::rest) = do
-
573 |       ti <- normaliseCons ti
-
574 |       let subes = concatMap allVarNames' $ subexprs ti
-
575 |       new <- map join $ for (SortedSet.toList subes) $ \n =>
-
576 |                if isNothing $ lookupByType n
-
577 |                  then map toList $ catch $ getInfo' n
-
578 |                  else pure []
-
579 |       let next = { types $= insert ti.name ti
-
580 |                  , namesInTypes $= insert ti subes
-
581 |                  , cons $= mergeLeft $ fromList $ ti.cons <&> \con => (con.name, ti, con)
-
582 |                  } tyi
-
583 |       assert_total $ go next (new ++ rest)
-
584 |
-
585 | export
-
586 | getNamesInfoInTypes' : Elaboration m => TTImp -> m NamesInfoInTypes
-
587 | getNamesInfoInTypes' expr = do
-
588 |   let varsFirstOrder = allVarNames expr
-
589 |   varsSecondOrder <- map concat $ Prelude.for varsFirstOrder $ \n => do
-
590 |                        ns <- getType n
-
591 |                        pure $ SortedSet.insert n $ flip concatMap ns $ \(n', ty) => insert n' $ allVarNames' ty
-
592 |   tys <- map (mapMaybe id) $ for (SortedSet.toList varsSecondOrder) $ catch . getInfo'
-
593 |   concat <$> Prelude.for tys getNamesInfoInTypes
+
570 | -- Returns a list without duplications
+
571 | export
+
572 | allInvolvedTypes : Elaboration m => (minimalRig : Count) -> TypeInfo -> m $ List TypeInfo
+
573 | allInvolvedTypes minimalRig ti = toList <$> go [ti] empty where
+
574 |   go : (left : List TypeInfo) -> (curr : SortedMap Name TypeInfo) -> m $ SortedMap Name TypeInfo
+
575 |   go left curr = do
+
576 |     let (c::left) = filter (not . isJust . lookup' curr . name) left
+
577 |       | [] => pure curr
+
578 |     let next = insert c.name c curr
+
579 |     args <- atRig M0 $ join <$> for c.args typesOfArg
+
580 |     cons <- join <$> for c.tyCons typesOfCon
+
581 |     assert_total $ go (args ++ cons ++ left) next
+
582 |     where
+
583 |       atRig : Count -> m (List a) -> m (List a)
+
584 |       atRig rig act = if rig >= minimalRig then act else pure []
+
585 |
+
586 |       typesOfExpr : TTImp -> m $ List TypeInfo
+
587 |       typesOfExpr expr = map (mapMaybe id) $ for (allVarNames expr) $ catch . getInfo'
+
588 |
+
589 |       typesOfArg : Arg -> m $ List TypeInfo
+
590 |       typesOfArg arg = atRig arg.count $ typesOfExpr arg.type
+
591 |
+
592 |       typesOfCon : Con -> m $ List TypeInfo
+
593 |       typesOfCon con = [| atRig M0 (typesOfExpr con.type) ++ (join <$> for con.args typesOfArg) |]
594 |
-
595 | public export
-
596 | isVar : TTImp -> Bool
-
597 | isVar $ IVar {} = True
-
598 | isVar _         = False
-
599 |
-
600 | namespace UpToRenaming
-
601 |
-
602 |   mutual
-
603 |
-
604 |     compWithSubst : (subst : List $ These Name Name) => (from, to : Maybe Name) -> TTImp -> TTImp -> Bool
-
605 |     compWithSubst (Just n) (Just n') e e' = n == n' && (e == e') @{UpToSubst} || (e == e') @{UpToSubst @{Both n n' :: subst}}
-
606 |     compWithSubst (Just n) Nothing   e e' = (e == e') @{UpToSubst @{This n  :: subst}}
-
607 |     compWithSubst Nothing  (Just n') e e' = (e == e') @{UpToSubst @{That n' :: subst}}
-
608 |     compWithSubst Nothing  Nothing   e e' = (e == e') @{UpToSubst}
-
609 |
-
610 |     [UpToSubst] (subst : List $ These Name Name) => Eq TTImp where
-
611 |       IVar _ v == IVar _ v' = maybe (v == v') (== Both v v') $ flip find subst $ \ior => fromThis ior == Just v || fromThat ior == Just v'
-
612 |       IPi _ c i n a r == IPi _ c' i' n' a' r' =
-
613 |         c == c' && (assert_total $ i == i') && a == a' && (assert_total $ compWithSubst n n' r r')
-
614 |       ILam _ c i n a r == ILam _ c' i' n' a' r' =
-
615 |         c == c' && (assert_total $ i == i') && a == a' && (assert_total $ compWithSubst n n' r r')
-
616 |       ILet _ _ c n ty val s == ILet _ _ c' n' ty' val' s' =
-
617 |         c == c' && ty == ty' && val == val' && (assert_total $ compWithSubst (Just n) (Just n') s s')
+
595 | ||| Returns a name by the generator's type
+
596 | |||
+
597 | ||| Say, for the `Fuel -> Gen em (n ** Fin n)` it returns name of `Data.Fin.Fin`
+
598 | export
+
599 | genTypeName : (0 _ : Type) -> Elab Name
+
600 | genTypeName g = do
+
601 |   genTy <- quote g
+
602 |   let (_, genTy) = unPi genTy
+
603 |   let (lhs, args) = unAppAny genTy
+
604 |   let IVar _ lhsName = lhs
+
605 |     | _ => failAt (getFC lhs) "Generator or generator function expected"
+
606 |   let True = lhsName `nameConformsTo` `{Test.DepTyCheck.Gen.Gen}
+
607 |     | _ => failAt (getFC lhs) "Return type must be a generator of some type"
+
608 |   let [_, genTy] = args
+
609 |     | _ => failAt (getFC lhs) "Wrong number of type arguments of a generator"
+
610 |   let (_, genTy) = unDPair $ getExpr genTy
+
611 |   let (IVar _ genTy, _) = unApp genTy
+
612 |     | (genTy, _) => failAt (getFC genTy) "Expected a type name"
+
613 |   pure genTy
+
614 |
+
615 | ----------------------------------------------
+
616 | --- Analyzing dependently typed signatures ---
+
617 | ----------------------------------------------
618 |
-
619 |       ICase _ os t ty cs == ICase _ os' t' ty' cs' =
-
620 |         t == t' && (assert_total $ os == os') && ty == ty' && (assert_total $ cs == cs')
-
621 |       ILocal _ ds e == ILocal _ ds' e' =
-
622 |         (assert_total $ ds == ds') && e == e'
-
623 |       IUpdate _ fs t == IUpdate _ fs' t' =
-
624 |         (assert_total $ fs == fs') && t == t'
-
625 |
-
626 |       IApp _ f x == IApp _ f' x' = f == f' && x == x'
-
627 |       INamedApp _ f n x == INamedApp _ f' n' x' =
-
628 |         f == f' && n == n' && x == x'
-
629 |       IAutoApp _ f x == IAutoApp _ f' x' = f == f' && x == x'
-
630 |       IWithApp _ f x == IWithApp _ f' x' = f == f' && x == x'
-
631 |
-
632 |       ISearch _ n == ISearch _ n' = n == n'
-
633 |       IAlternative _ t as == IAlternative _ t' as' =
-
634 |         (assert_total $ t == t') && (assert_total $ as == as')
-
635 |       IRewrite _ p q == IRewrite _ p' q' =
-
636 |         p == p' && q == q'
-
637 |
-
638 |       IBindHere _ m t == IBindHere _ m' t' =
-
639 |         m == m' && t == t'
-
640 |       IBindVar _ s == IBindVar _ s' = s == s'
-
641 |       IAs _ _ u n t == IAs _ _ u' n' t' =
-
642 |         u == u' && n == n' && t == t'
-
643 |       IMustUnify _ r t == IMustUnify _ r' t' =
-
644 |         r == r' && t == t'
-
645 |
-
646 |       IDelayed _ r t == IDelayed _ r' t' = r == r' && t == t'
-
647 |       IDelay _ t == IDelay _ t' = t == t'
-
648 |       IForce _ t == IForce _ t' = t == t'
-
649 |
-
650 |       IQuote _ tm == IQuote _ tm' = tm == tm'
-
651 |       IQuoteName _ n == IQuoteName _ n' = n == n'
-
652 |       IQuoteDecl _ ds == IQuoteDecl _ ds' = assert_total $ ds == ds'
-
653 |       IUnquote _ tm == IUnquote _ tm' = tm == tm'
-
654 |
-
655 |       IPrimVal _ c == IPrimVal _ c' = c == c'
-
656 |       IType _ == IType _ = True
-
657 |       IHole _ s == IHole _ s' = True -- Holes are anyway unique and does not matter what the names are.
-
658 |
-
659 |       Implicit _ b == Implicit _ b' = b == b'
-
660 |       IWithUnambigNames _ ns t == IWithUnambigNames _ ns' t' =
-
661 |         map snd ns == map snd ns' && t == t'
-
662 |
-
663 |       _ == _ = False
-
664 |
-
665 |   export
-
666 |   [UpToRenaming] Eq TTImp where
-
667 |     x == y = (x == y) @{UpToSubst @{empty}}
-
668 |
-
669 | -- Returns a list without duplications
-
670 | export
-
671 | allInvolvedTypes : Elaboration m => (minimalRig : Count) -> TypeInfo -> m $ List TypeInfo
-
672 | allInvolvedTypes minimalRig ti = toList <$> go [ti] empty where
-
673 |   go : (left : List TypeInfo) -> (curr : SortedMap Name TypeInfo) -> m $ SortedMap Name TypeInfo
-
674 |   go left curr = do
-
675 |     let (c::left) = filter (not . isJust . lookup' curr . name) left
-
676 |       | [] => pure curr
-
677 |     let next = insert c.name c curr
-
678 |     args <- atRig M0 $ join <$> for c.args typesOfArg
-
679 |     cons <- join <$> for c.tyCons typesOfCon
-
680 |     assert_total $ go (args ++ cons ++ left) next
-
681 |     where
-
682 |       atRig : Count -> m (List a) -> m (List a)
-
683 |       atRig rig act = if rig >= minimalRig then act else pure []
-
684 |
-
685 |       typesOfExpr : TTImp -> m $ List TypeInfo
-
686 |       typesOfExpr expr = map (mapMaybe id) $ for (allVarNames expr) $ catch . getInfo'
-
687 |
-
688 |       typesOfArg : Arg -> m $ List TypeInfo
-
689 |       typesOfArg arg = atRig arg.count $ typesOfExpr arg.type
-
690 |
-
691 |       typesOfCon : Con -> m $ List TypeInfo
-
692 |       typesOfCon con = [| atRig M0 (typesOfExpr con.type) ++ (join <$> for con.args typesOfArg) |]
-
693 |
-
694 | ||| Returns a name by the generator's type
-
695 | |||
-
696 | ||| Say, for the `Fuel -> Gen em (n ** Fin n)` it returns name of `Data.Fin.Fin`
-
697 | export
-
698 | genTypeName : (0 _ : Type) -> Elab Name
-
699 | genTypeName g = do
-
700 |   genTy <- quote g
-
701 |   let (_, genTy) = unPi genTy
-
702 |   let (lhs, args) = unAppAny genTy
-
703 |   let IVar _ lhsName = lhs
-
704 |     | _ => failAt (getFC lhs) "Generator or generator function expected"
-
705 |   let True = lhsName `nameConformsTo` `{Test.DepTyCheck.Gen.Gen}
-
706 |     | _ => failAt (getFC lhs) "Return type must be a generator of some type"
-
707 |   let [_, genTy] = args
-
708 |     | _ => failAt (getFC lhs) "Wrong number of type arguments of a generator"
-
709 |   let (_, genTy) = unDPair $ getExpr genTy
-
710 |   let (IVar _ genTy, _) = unApp genTy
-
711 |     | (genTy, _) => failAt (getFC genTy) "Expected a type name"
-
712 |   pure genTy
-
713 |
+
619 | export
+
620 | argDeps : (args : List Arg) -> DVect args.length $ SortedSet . Fin . Fin.finToNat
+
621 | argDeps args = do
+
622 |   let nameToIndices = SortedMap.fromList $ mapI args $ \i, arg => (argName arg, SortedSet.singleton i)
+
623 |   let args = Vect.fromList args <&> \arg => allVarNames arg.type |> map (fromMaybe empty . lookup' nameToIndices)
+
624 |   flip upmapI args $ \i, argDeps => flip concatMap argDeps $ \candidates =>
+
625 |     maybe empty singleton $ last' $ mapMaybe tryToFit $ SortedSet.toList candidates
+
626 |
diff --git a/docs/deptycheck/docs/docs/Language.Reflection.Compat.html b/docs/deptycheck/docs/docs/Language.Reflection.Compat.html index bae205551..9056747f0 100644 --- a/docs/deptycheck/docs/docs/Language.Reflection.Compat.html +++ b/docs/deptycheck/docs/docs/Language.Reflection.Compat.html @@ -66,4 +66,4 @@ This is done due to be able to migrate to the newer `elab-util` slowly, using both old and new definitions. This copying is done with the permission of Stefan Höck, the author and copyright holder of the `elab-util` library. -

Reexports

importpublic Data.List.Quantifiers
importpublic Data.List1
importpublic Data.String
importpublic Data.Vect
importpublic Language.Reflection
importpublic Language.Reflection.Syntax
importpublic Language.Reflection.Syntax.Ops

Definitions

stname : MaybeName->Name
Totality: total
Visibility: public export
argName : Arg->Name
Totality: total
Visibility: public export
recordCon : Type
  Constructor of a data type

Totality: total
Visibility: public export
Constructor: 
MkCon : Name->ListArg->TTImp->Con

Projections:
.args : Con->ListArg
.name : Con->Name
.type : Con->TTImp

Hint: 
SingleLogPositionCon
.name : Con->Name
Totality: total
Visibility: public export
name : Con->Name
Totality: total
Visibility: public export
.args : Con->ListArg
Totality: total
Visibility: public export
args : Con->ListArg
Totality: total
Visibility: public export
.type : Con->TTImp
Totality: total
Visibility: public export
type : Con->TTImp
Totality: total
Visibility: public export
getCon : Elaborationm=>Name->mCon
  Tries to lookup a constructor by name.

Totality: total
Visibility: export
recordTypeInfo : Type
  Information about a data type

@name : Name of the data type
Note: There is no guarantee that the name will be fully
qualified
@args : Type arguments of the data type
@cons : List of data constructors

Totality: total
Visibility: public export
Constructor: 
MkTypeInfo : Name->ListArg->ListCon->TypeInfo

Projections:
.args : TypeInfo->ListArg
.cons : TypeInfo->ListCon
.name : TypeInfo->Name

Hints:
EqTypeInfo
OrdTypeInfo
.name : TypeInfo->Name
Totality: total
Visibility: public export
name : TypeInfo->Name
Totality: total
Visibility: public export
.args : TypeInfo->ListArg
Totality: total
Visibility: public export
args : TypeInfo->ListArg
Totality: total
Visibility: public export
.cons : TypeInfo->ListCon
Totality: total
Visibility: public export
cons : TypeInfo->ListCon
Totality: total
Visibility: public export
getInfo' : Elaborationm=>Name->mTypeInfo
  Tries to get information about the data type specified
by name. The name need not be fully qualified, but
needs to be unambiguous.

Totality: total
Visibility: export
getInfo : Name->ElabTypeInfo
  macro version of `getInfo'`

Totality: total
Visibility: export
dataIsNamedArg : Arg->Type
Totality: total
Visibility: public export
Constructor: 
ItIsNamed : IsNamedArg (MkArgcntpii (Justn) ty)
isNamedArg : (arg : Arg) ->Dec (IsNamedArgarg)
Totality: total
Visibility: public export
dataConArgsNamed : Con->Type
Totality: total
Visibility: public export
Constructor: 
TheyAreNamed : AllIsNamedArgars->ConArgsNamed (MkConnmarsty)
areConArgsNamed : (con : Con) ->Dec (ConArgsNamedcon)
Totality: total
Visibility: public export
dataAllTyArgsNamed : TypeInfo->Type
Totality: total
Visibility: public export
Constructor: 
TheyAllAreNamed : AllIsNamedArgars->AllConArgsNamedcns->AllTyArgsNamed (MkTypeInfonmarscns)
areAllTyArgsNamed : (ty : TypeInfo) ->Dec (AllTyArgsNamedty)
Totality: total
Visibility: public export
.tyArgs : TypeInfo->ListArg
Totality: total
Visibility: public export
.tyCons : TypeInfo->ListCon
Totality: total
Visibility: public export
.conArgs : Con->ListArg
Totality: total
Visibility: public export
+

Reexports

importpublic Data.List.Quantifiers
importpublic Data.List1
importpublic Data.String
importpublic Data.Vect
importpublic Language.Reflection
importpublic Language.Reflection.Syntax
importpublic Language.Reflection.Syntax.Ops

Definitions

stname : MaybeName->Name
Totality: total
Visibility: public export
argName : Arg->Name
Totality: total
Visibility: public export
recordCon : Type
  Constructor of a data type

Totality: total
Visibility: public export
Constructor: 
MkCon : Name->ListArg->TTImp->Con

Projections:
.args : Con->ListArg
.name : Con->Name
.type : Con->TTImp

Hint: 
SingleLogPositionCon
.name : Con->Name
Totality: total
Visibility: public export
name : Con->Name
Totality: total
Visibility: public export
.args : Con->ListArg
Totality: total
Visibility: public export
args : Con->ListArg
Totality: total
Visibility: public export
.type : Con->TTImp
Totality: total
Visibility: public export
type : Con->TTImp
Totality: total
Visibility: public export
getCon : Elaborationm=>Name->mCon
  Tries to lookup a constructor by name.

Totality: total
Visibility: export
recordTypeInfo : Type
  Information about a data type

@name : Name of the data type
Note: There is no guarantee that the name will be fully
qualified
@args : Type arguments of the data type
@cons : List of data constructors

Totality: total
Visibility: public export
Constructor: 
MkTypeInfo : Name->ListArg->ListCon->TypeInfo

Projections:
.args : TypeInfo->ListArg
.cons : TypeInfo->ListCon
.name : TypeInfo->Name

Hints:
EqTypeInfo
OrdTypeInfo
.name : TypeInfo->Name
Totality: total
Visibility: public export
name : TypeInfo->Name
Totality: total
Visibility: public export
.args : TypeInfo->ListArg
Totality: total
Visibility: public export
args : TypeInfo->ListArg
Totality: total
Visibility: public export
.cons : TypeInfo->ListCon
Totality: total
Visibility: public export
cons : TypeInfo->ListCon
Totality: total
Visibility: public export
getInfo' : Elaborationm=>Name->mTypeInfo
  Tries to get information about the data type specified
by name. The name need not be fully qualified, but
needs to be unambiguous.

Totality: total
Visibility: export
getInfo : Name->ElabTypeInfo
  macro version of `getInfo'`

Totality: total
Visibility: export
dataIsNamedArg : Arg->Type
Totality: total
Visibility: public export
Constructor: 
ItIsNamed : IsNamedArg (MkArgcntpii (Justn) ty)
isNamedArg : (arg : Arg) ->Dec (IsNamedArgarg)
Totality: total
Visibility: public export
dataConArgsNamed : Con->Type
Totality: total
Visibility: public export
Constructor: 
TheyAreNamed : AllIsNamedArgars->ConArgsNamed (MkConnmarsty)
areConArgsNamed : (con : Con) ->Dec (ConArgsNamedcon)
Totality: total
Visibility: public export
dataAllTyArgsNamed : TypeInfo->Type
Totality: total
Visibility: public export
Constructor: 
TheyAllAreNamed : AllIsNamedArgars->AllConArgsNamedcns->AllTyArgsNamed (MkTypeInfonmarscns)
areAllTyArgsNamed : (ty : TypeInfo) ->Dec (AllTyArgsNamedty)
Totality: total
Visibility: public export
.tyArgs : TypeInfo->ListArg
Totality: total
Visibility: public export
.tyCons : TypeInfo->ListCon
Totality: total
Visibility: public export
.conArgs : Con->ListArg
Totality: total
Visibility: public export
diff --git a/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Coverage.html b/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Coverage.html index fce5fdf16..a02875790 100644 --- a/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Coverage.html +++ b/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Coverage.html @@ -65,4 +65,4 @@ Model coverage means a coverage in terms of the original data structure that is being generated, e.g. involved types and their constructors. -

Reexports

importpublic Deriving.DepTyCheck.Util.Logging
importpublic Deriving.DepTyCheck.Util.Reflection
importpublic Language.Reflection

Definitions

recordModelCoverage : Type
  Raw information of covered labels

Totality: total
Visibility: public export
Constructor: 
MkModelCoverage : SortedMapLabelNat->ModelCoverage

Projection: 
.unModelCoverage : ModelCoverage->SortedMapLabelNat

Hints:
MonadWriterModelCoveragem=>CanManageLabelsm
MonoidModelCoverage
SemigroupModelCoverage
.unModelCoverage : ModelCoverage->SortedMapLabelNat
Totality: total
Visibility: public export
unModelCoverage : ModelCoverage->SortedMapLabelNat
Totality: total
Visibility: public export
unGenD : MonadRandomm=>MonadError () m=>Genema->m (ModelCoverage, a)
Totality: total
Visibility: export
unGenD' : MonadRandomm=>Genema->m (Maybe (ModelCoverage, a))
Totality: total
Visibility: export
unGenTryAllD' : RandomGeng=>g->Genema->Stream (g, Maybe (ModelCoverage, a))
Totality: total
Visibility: export
unGenTryAllD : RandomGeng=>g->Genema->Stream (Maybe (ModelCoverage, a))
Totality: total
Visibility: export
unGenTryND : RandomGeng=>Nat->g->Genema->LazyList (ModelCoverage, a)
Totality: total
Visibility: export
recordCoverageGenInfo : (0_ : k) ->Type
  Higher-level coverage information, in terms of types and constructors, etc.

Totality: total
Visibility: export
Constructor: 
MkCoverageGenInfo : SortedMapStringTypeInfo->SortedMapString (TypeInfo, Con) ->SortedMapTypeInfo (Nat, SortedMapConNat) ->CoverageGenInfog

Projections:
.constructors : CoverageGenInfog->SortedMapString (TypeInfo, Con)
.coverageInfo : CoverageGenInfog->SortedMapTypeInfo (Nat, SortedMapConNat)
.types : CoverageGenInfog->SortedMapStringTypeInfo

Hint: 
Show (CoverageGenInfog)
initCoverageInfo' : (n : Name) ->Elab (CoverageGenInfon)
Totality: total
Visibility: export
initCoverageInfo : (0x : g) ->Elab (CoverageGenInfox)
Totality: total
Visibility: export
withCoverage : Genema->Elab (Genema)
  Adds labelling of types and constructors to a given generator

Added labelling is not deep, i.e. it adds labels only for the returned type of a generator.
If returned type is a dependent pair, the rightmost type is taken into the account.

Totality: total
Visibility: export
registerCoverage : ModelCoverage->CoverageGenInfog->CoverageGenInfog
Totality: total
Visibility: export
+

Reexports

importpublic Deriving.DepTyCheck.Util.Logging
importpublic Deriving.DepTyCheck.Util.Reflection
importpublic Language.Reflection

Definitions

recordModelCoverage : Type
  Raw information of covered labels

Totality: total
Visibility: public export
Constructor: 
MkModelCoverage : SortedMapLabelNat->ModelCoverage

Projection: 
.unModelCoverage : ModelCoverage->SortedMapLabelNat

Hints:
MonadWriterModelCoveragem=>CanManageLabelsm
MonoidModelCoverage
SemigroupModelCoverage
.unModelCoverage : ModelCoverage->SortedMapLabelNat
Totality: total
Visibility: public export
unModelCoverage : ModelCoverage->SortedMapLabelNat
Totality: total
Visibility: public export
unGenD : MonadRandomm=>MonadError () m=>Genema->m (ModelCoverage, a)
Totality: total
Visibility: export
unGenD' : MonadRandomm=>Genema->m (Maybe (ModelCoverage, a))
Totality: total
Visibility: export
unGenTryAllD' : RandomGeng=>g->Genema->Stream (g, Maybe (ModelCoverage, a))
Totality: total
Visibility: export
unGenTryAllD : RandomGeng=>g->Genema->Stream (Maybe (ModelCoverage, a))
Totality: total
Visibility: export
unGenTryND : RandomGeng=>Nat->g->Genema->LazyList (ModelCoverage, a)
Totality: total
Visibility: export
recordCoverageGenInfo : (0_ : k) ->Type
  Higher-level coverage information, in terms of types and constructors, etc.

Totality: total
Visibility: export
Constructor: 
MkCoverageGenInfo : SortedMapStringTypeInfo->SortedMapString (TypeInfo, Con) ->SortedMapTypeInfo (Nat, SortedMapConNat) ->CoverageGenInfog

Projections:
.constructors : CoverageGenInfog->SortedMapString (TypeInfo, Con)
.coverageInfo : CoverageGenInfog->SortedMapTypeInfo (Nat, SortedMapConNat)
.types : CoverageGenInfog->SortedMapStringTypeInfo

Hint: 
Show (CoverageGenInfog)
initCoverageInfo' : (n : Name) ->Elab (CoverageGenInfon)
Totality: total
Visibility: export
initCoverageInfo : (0x : g) ->Elab (CoverageGenInfox)
Totality: total
Visibility: export
withCoverage : Genema->Elab (Genema)
  Adds labelling of types and constructors to a given generator

Added labelling is not deep, i.e. it adds labels only for the returned type of a generator.
If returned type is a dependent pair, the rightmost type is taken into the account.

Totality: total
Visibility: export
registerCoverage : ModelCoverage->CoverageGenInfog->CoverageGenInfog
Totality: total
Visibility: export
diff --git a/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Emptiness.html b/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Emptiness.html index e27f509bc..404300b79 100644 --- a/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Emptiness.html +++ b/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Emptiness.html @@ -61,4 +61,4 @@ -

Test.DepTyCheck.Gen.Emptiness

(source)

Reexports

importpublic Language.Implicits.IfUnsolved

Definitions

dataEmptiness : Type
Totality: total
Visibility: public export
Constructors:
NonEmpty : Emptiness
MaybeEmptyDeep : Emptiness
MaybeEmpty : Emptiness

Hints:
Alternative (GenAlternativesFalseem)
AntisymmetricEmptinessNoWeaker
Applicative (Genem)
Applicative (GenAlternativesneem)
BindToOuterNonEmptyem
BindToOuteremem
Cast (LazyLstnea) (GenAlternativesneema)
ConnexEmptinessNoWeaker
EqEmptiness
Functor (Genem)
Functor (GenAlternativesneem)
LinearOrderEmptinessNoWeaker
Monad (Genem)
Monad (GenAlternativesTrueem)
Not (a `NoWeaker` b) ->b `NoWeaker` a
NonEmpty `NoWeaker` em
em `NoWeaker` em
PartialOrderEmptinessNoWeaker
PreorderEmptinessNoWeaker
ReflexiveEmptinessNoWeaker
ReflexiveEmptinessBindToOuter
StronglyConnexEmptinessNoWeaker
TransitiveEmptinessNoWeaker
dataNoWeaker : Emptiness->Emptiness->Type
Totality: total
Visibility: public export
Constructors:
NN : NonEmpty `NoWeaker` NonEmpty
ND : NonEmpty `NoWeaker` MaybeEmptyDeep
DD : MaybeEmptyDeep `NoWeaker` MaybeEmptyDeep
AS : em `NoWeaker` MaybeEmpty

Hints:
AntisymmetricEmptinessNoWeaker
ConnexEmptinessNoWeaker
LinearOrderEmptinessNoWeaker
Not (a `NoWeaker` b) ->b `NoWeaker` a
NonEmpty `NoWeaker` em
em `NoWeaker` em
PartialOrderEmptinessNoWeaker
PreorderEmptinessNoWeaker
ReflexiveEmptinessNoWeaker
StronglyConnexEmptinessNoWeaker
TransitiveEmptinessNoWeaker

Fixity Declaration: infix operator, level 6
transitive' : x `NoWeaker` y->y `NoWeaker` z->x `NoWeaker` z
Totality: total
Visibility: export
CanBeEmpty : Emptiness->Type
Totality: total
Visibility: public export
decCanBeEmpty : (em : Emptiness) ->Dec (CanBeEmptyem)
Totality: total
Visibility: export
extractNE : (0_ : Not (CanBeEmptyem)) ->em=NonEmpty
Totality: total
Visibility: export
canBeEmpty : (em : Emptiness) ->Either (em=NonEmpty) (CanBeEmptyem)
Totality: total
Visibility: export
NotImmediatelyEmpty : Emptiness->Type
Totality: total
Visibility: public export
canBeNotImmediatelyEmpty : (em : Emptiness) ->Either (em=MaybeEmpty) (NotImmediatelyEmptyem)
Totality: total
Visibility: export
relaxAnyCanBeEmpty : CanBeEmptycbe=>em `NoWeaker` MaybeEmptyDeep->em `NoWeaker` cbe
Totality: total
Visibility: export
rev : Not (a `NoWeaker` b) ->b `NoWeaker` a
Totality: total
Visibility: export
nonEmptyIsStrongest : NonEmpty `NoWeaker` em
Totality: total
Visibility: export
nonEmptyReflexive : em `NoWeaker` em
Totality: total
Visibility: export
dataBindToOuter : Emptiness->Emptiness->Type
Totality: total
Visibility: public export
Constructor: 
BTO : (CanBeEmptybiem->CanBeEmptyem) ->BindToOuterbiemem

Hints:
BindToOuterNonEmptyem
BindToOuteremem
ReflexiveEmptinessBindToOuter
BindNE : BindToOuterNonEmptyem
Totality: total
Visibility: export
extractNE : (0_ : BindToOuteremNonEmpty) ->em=NonEmpty
Totality: total
Visibility: export
btoRefl : BindToOuteremem
Totality: total
Visibility: export
bindToOuterRelax : BindToOuterxy->y `NoWeaker` z->BindToOuterxz
Totality: total
Visibility: export
+

Test.DepTyCheck.Gen.Emptiness

(source)

Reexports

importpublic Language.Implicits.IfUnsolved

Definitions

dataEmptiness : Type
Totality: total
Visibility: public export
Constructors:
NonEmpty : Emptiness
MaybeEmptyDeep : Emptiness
MaybeEmpty : Emptiness

Hints:
Alternative (GenAlternativesFalseem)
AntisymmetricEmptinessNoWeaker
Applicative (Genem)
Applicative (GenAlternativesneem)
BindToOuterNonEmptyem
BindToOuteremem
Cast (LazyLstnea) (GenAlternativesneema)
ConnexEmptinessNoWeaker
EqEmptiness
Functor (Genem)
Functor (GenAlternativesneem)
LinearOrderEmptinessNoWeaker
Monad (Genem)
Monad (GenAlternativesTrueem)
Not (a `NoWeaker` b) ->b `NoWeaker` a
NonEmpty `NoWeaker` em
em `NoWeaker` em
PartialOrderEmptinessNoWeaker
PreorderEmptinessNoWeaker
ReflexiveEmptinessNoWeaker
ReflexiveEmptinessBindToOuter
StronglyConnexEmptinessNoWeaker
TransitiveEmptinessNoWeaker
dataNoWeaker : Emptiness->Emptiness->Type
Totality: total
Visibility: public export
Constructors:
NN : NonEmpty `NoWeaker` NonEmpty
ND : NonEmpty `NoWeaker` MaybeEmptyDeep
DD : MaybeEmptyDeep `NoWeaker` MaybeEmptyDeep
AS : em `NoWeaker` MaybeEmpty

Hints:
AntisymmetricEmptinessNoWeaker
ConnexEmptinessNoWeaker
LinearOrderEmptinessNoWeaker
Not (a `NoWeaker` b) ->b `NoWeaker` a
NonEmpty `NoWeaker` em
em `NoWeaker` em
PartialOrderEmptinessNoWeaker
PreorderEmptinessNoWeaker
ReflexiveEmptinessNoWeaker
StronglyConnexEmptinessNoWeaker
TransitiveEmptinessNoWeaker

Fixity Declaration: infix operator, level 6
transitive' : x `NoWeaker` y->y `NoWeaker` z->x `NoWeaker` z
Totality: total
Visibility: export
CanBeEmpty : Emptiness->Type
Totality: total
Visibility: public export
decCanBeEmpty : (em : Emptiness) ->Dec (CanBeEmptyem)
Totality: total
Visibility: export
extractNE : (0_ : Not (CanBeEmptyem)) ->em=NonEmpty
Totality: total
Visibility: export
canBeEmpty : (em : Emptiness) ->Either (em=NonEmpty) (CanBeEmptyem)
Totality: total
Visibility: export
NotImmediatelyEmpty : Emptiness->Type
Totality: total
Visibility: public export
canBeNotImmediatelyEmpty : (em : Emptiness) ->Either (em=MaybeEmpty) (NotImmediatelyEmptyem)
Totality: total
Visibility: export
relaxAnyCanBeEmpty : CanBeEmptycbe=>em `NoWeaker` MaybeEmptyDeep->em `NoWeaker` cbe
Totality: total
Visibility: export
rev : Not (a `NoWeaker` b) ->b `NoWeaker` a
Totality: total
Visibility: export
nonEmptyIsStrongest : NonEmpty `NoWeaker` em
Totality: total
Visibility: export
nonEmptyReflexive : em `NoWeaker` em
Totality: total
Visibility: export
dataBindToOuter : Emptiness->Emptiness->Type
Totality: total
Visibility: public export
Constructor: 
BTO : (CanBeEmptybiem->CanBeEmptyem) ->BindToOuterbiemem

Hints:
BindToOuterNonEmptyem
BindToOuteremem
ReflexiveEmptinessBindToOuter
BindNE : BindToOuterNonEmptyem
Totality: total
Visibility: export
extractNE : (0_ : BindToOuteremNonEmpty) ->em=NonEmpty
Totality: total
Visibility: export
btoRefl : BindToOuteremem
Totality: total
Visibility: export
bindToOuterRelax : BindToOuterxy->y `NoWeaker` z->BindToOuterxz
Totality: total
Visibility: export
diff --git a/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Labels.html b/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Labels.html index 6f7b4920c..66a282672 100644 --- a/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Labels.html +++ b/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.Labels.html @@ -61,4 +61,4 @@ -

Test.DepTyCheck.Gen.Labels

(source)

Definitions

dataLabel : Type
Totality: total
Visibility: export
Constructor: 
StringLabel : String->Label

Hints:
EqLabel
FromStringLabel
OrdLabel
ShowLabel
interfaceCanManageLabels : (Type->Type) ->Type
Parameters: m
Methods:
manageLabel : Label->ma->ma

Implementation: 
MonadWriterModelCoveragem=>CanManageLabelsm
manageLabel : CanManageLabelsm=>Label->ma->ma
Totality: total
Visibility: public export
IgnoreLabels : CanManageLabelsm
Totality: total
Visibility: export
+

Test.DepTyCheck.Gen.Labels

(source)

Definitions

dataLabel : Type
Totality: total
Visibility: export
Constructor: 
StringLabel : String->Label

Hints:
EqLabel
FromStringLabel
OrdLabel
ShowLabel
interfaceCanManageLabels : (Type->Type) ->Type
Parameters: m
Methods:
manageLabel : Label->ma->ma

Implementation: 
MonadWriterModelCoveragem=>CanManageLabelsm
manageLabel : CanManageLabelsm=>Label->ma->ma
Totality: total
Visibility: public export
IgnoreLabels : CanManageLabelsm
Totality: total
Visibility: export
diff --git a/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.html b/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.html index 48fa7b55f..1db07b59f 100644 --- a/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.html +++ b/docs/deptycheck/docs/docs/Test.DepTyCheck.Gen.html @@ -61,4 +61,4 @@ -

Test.DepTyCheck.Gen

(source)

Reexports

importpublic Control.Monad.Error.Interface
importpublic Control.Monad.Random.Interface
importpublic Control.Monad.State.Interface
importpublic Data.CheckedEmpty.List.Lazy
importpublic Data.Nat1
importpublic Language.Implicits.IfUnsolved
importpublic Test.DepTyCheck.Gen.Emptiness
importpublic Test.DepTyCheck.Gen.Labels

Definitions

wrapLazy : (a->b) -> Lazy a-> Lazy b
Totality: total
Visibility: public export
dataGen : Emptiness->Type->Type
Totality: total
Visibility: export
Constructors:
Empty : GenMaybeEmptya
Pure : a->Genema
Raw : RawGena->Genema
OneOf : alem `NoWeaker` em=>NotImmediatelyEmptyalem=>GenAlternativesTruealema->Genema
Bind : {auto0_ : BindToOuterbiemem} ->RawGenc-> (c->Genbiema) ->Genema
Labelled : Label->Genema->Genema

Hints:
Applicative (Genem)
Functor (Genem)
Monad (Genem)
recordGenAlternatives : (0_ : Bool) ->Emptiness->Type->Type
Totality: total
Visibility: export
Constructor: 
MkGenAlts : LazyLstmustBeNotEmpty (Nat1, Lazy (Genema)) ->GenAlternativesmustBeNotEmptyema

Projection: 
.unGenAlts : GenAlternativesmustBeNotEmptyema->LazyLstmustBeNotEmpty (Nat1, Lazy (Genema))

Hints:
Alternative (GenAlternativesFalseem)
Applicative (GenAlternativesneem)
Cast (LazyLstnea) (GenAlternativesneema)
Functor (GenAlternativesneem)
Monad (GenAlternativesTrueem)
Gen1 : Type->Type
Totality: total
Visibility: public export
Gen0 : Type->Type
  Generator with least guarantees on emptiness.

This type should not be used as an input argument unless it is strictly required.
You should prefer to be polymorphic on emptiness instead.

Totality: total
Visibility: public export
chooseAny : Randoma=> {auto0_ : IfUnsolvedneNonEmpty} ->Gennea
Totality: total
Visibility: export
chooseAnyOf : (0a : Type) ->Randoma=> {auto0_ : IfUnsolvedneNonEmpty} ->Gennea
Totality: total
Visibility: public export
choose : Randoma=> {auto0_ : IfUnsolvedneNonEmpty} -> (a, a) ->Gennea
Totality: total
Visibility: export
empty : Gen0a
Totality: total
Visibility: export
label : Label->Genema->Genema
Totality: total
Visibility: export
dataEquiv : Genlema->Genrema->Type
Totality: total
Visibility: export
Constructors:
EE : EquivEmptyEmpty
EP : Equiv (Purex) (Purex)
ER : Equiv (Rawx) (Rawx)
EO : AltsEquivlgsrgs=>Equiv (OneOf (MkGenAltslgs)) (OneOf (MkGenAltsrgs))
EB : Equiv (Bindxg) (Bindxg)
relax : iem `NoWeaker` em=>Geniema->Genema
Totality: total
Visibility: export
strengthen : Geniema->Maybe (Genema)
Totality: total
Visibility: export
unGen1 : MonadRandomm=>CanManageLabelsm=>Gen1a->ma
Totality: total
Visibility: export
unGenAll' : RandomGeng=>g->Gen1a->Stream (g, a)
Totality: total
Visibility: export
unGenAll : RandomGeng=>g->Gen1a->Streama
Totality: total
Visibility: export
pick1 : CanInitSeedgm=>Functorm=>Gen1a->ma
  Picks one random value from a generator

Totality: total
Visibility: export
unGen : MonadRandomm=>MonadError () m=>CanManageLabelsm=>Genema->ma
Totality: total
Visibility: export
unGen' : MonadRandomm=>CanManageLabelsm=>Genema->m (Maybea)
Totality: total
Visibility: export
unGenTryAll' : RandomGeng=>g->Genema->Stream (g, Maybea)
Totality: total
Visibility: export
unGenTryAll : RandomGeng=>g->Genema->Stream (Maybea)
Totality: total
Visibility: export
unGenTryN : RandomGeng=>Nat->g->Genema->LazyLista
Totality: total
Visibility: export
pick : CanInitSeedgm=>Functorm=>Genema->m (Maybea)
  Tries once to pick a random value from a generator

Totality: total
Visibility: export
pickTryN : CanInitSeedgm=>Functorm=> (n : Nat) ->Genema->m (Maybe (Finn, a))
  Tries to pick a random value from a generator, returning the number of unsuccessful attempts, if generated successfully

Totality: total
Visibility: export
Nil : GenAlternativesFalseema
Totality: total
Visibility: export
(::) : lem `NoWeaker` em=>rem `NoWeaker` em=> {auto0_ : IfUnsolvedeTrue} -> {auto0_ : IfUnsolvedemNonEmpty} -> {auto0_ : IfUnsolvedlemem} -> {auto0_ : IfUnsolvedremem} -> Lazy (Genlema) -> Lazy (GenAlternativeserema) ->GenAlternativesneema
Totality: total
Visibility: export
Fixity Declaration: infixr operator, level 7
(++) : lem `NoWeaker` em=>rem `NoWeaker` em=> {auto0_ : IfUnsolvedlemem} -> {auto0_ : IfUnsolvedremem} -> {auto0_ : IfUnsolvednelFalse} -> {auto0_ : IfUnsolvednerFalse} ->GenAlternativesnellema-> Lazy (GenAlternativesnerrema) ->GenAlternatives (nel|| Delay ner) ema
Totality: total
Visibility: public export
Fixity Declaration: infixr operator, level 7
length : GenAlternativesneema->Nat
Totality: total
Visibility: public export
processAlternatives : (Genema->Genemb) ->GenAlternativesneema->GenAlternativesneemb
Totality: total
Visibility: export
processAlternativesMaybe : (Genema->Maybe (Lazy (Genemb))) ->GenAlternativesneema->GenAlternativesFalseemb
Totality: total
Visibility: export
processAlternatives'' : (Genema->GenAlternativesnebemb) ->GenAlternativesneaema->GenAlternatives (nea&& Delay neb) emb
Totality: total
Visibility: export
processAlternatives' : (Genema->GenAlternativesneemb) ->GenAlternativesneema->GenAlternativesneemb
Totality: total
Visibility: export
relax : GenAlternativesTrueema->GenAlternativesneema
Totality: total
Visibility: export
strengthen : GenAlternativesneema->Maybe (GenAlternativesTrueema)
Totality: total
Visibility: export
altsFromList : LazyLstnea->GenAlternativesneema
Totality: total
Visibility: public export
dataAltsNonEmpty : Bool->Emptiness->Type
Totality: total
Visibility: public export
Constructors:
NT : AltsNonEmptyTrueNonEmpty
DT : AltsNonEmptyTrueMaybeEmptyDeep
Sx : AltsNonEmptyaltsNeMaybeEmpty
altsNonEmptyTrue : AltsNonEmptyTrueem
Totality: total
Visibility: export
oneOf : alem `NoWeaker` em=>AltsNonEmptyaltsNeem=> {auto0_ : IfUnsolvedalemem} -> {auto0_ : IfUnsolvedaltsNe (em/=MaybeEmpty)} ->GenAlternativesaltsNealema->Genema
  Choose one of the given generators uniformly.

All the given generators are treated as independent, i.e. `oneOf [oneOf [a, b], c]` is not the same as `oneOf [a, b, c]`.
In this example case, generator `oneOf [a, b]` and generator `c` will have the same probability in the resulting generator.

Totality: total
Visibility: export
frequency : alem `NoWeaker` em=>AltsNonEmptyaltsNeem=> {auto0_ : IfUnsolvedalemem} -> {auto0_ : IfUnsolvedaltsNe (em/=MaybeEmpty)} ->LazyLstaltsNe (Nat1, Lazy (Genalema)) ->Genema
  Choose one of the given generators with probability proportional to the given value, treating all source generators independently.

This function treats given generators in the same way as `oneOf` do, but the resulting generator uses generator
from the given list the more frequently, the higher number is has.
If generator `g1` has the frequency `n1` and generator `g2` has the frequency `n2`, than `g1` will be used `n1/n2` times
more frequently than `g2` in the resulting generator (in case when `g1` and `g2` always generate some value).

Totality: total
Visibility: export
elements : AltsNonEmptyaltsNeem=> {auto0_ : IfUnsolvedemNonEmpty} -> {auto0_ : IfUnsolvedaltsNe (em/=MaybeEmpty)} ->LazyLstaltsNea->Genema
  Choose one of the given values uniformly.

This function is equivalent to `oneOf` applied to list of `pure` generators per each value.

Totality: total
Visibility: export
elements' : Foldablef=> {auto0_ : IfUnsolvedfList} ->fa->Gen0a
Totality: total
Visibility: export
alternativesOf : Genema->GenAlternativesTrueema
  Shallow alternatives of a generator.

If the given generator is made by one of `oneOf`, `frequency` or `elements`,
this function returns alternatives which this generators contains.
Otherwise it retuns a single-element alternative list containing given generator.

In a sense, this function is a reverse function of `oneOf`, i.g.
`oneOf $ alternativesOf g` must be equivalent to `g` and
`alternativesof $ oneOf gs` must be equivalent to `gs`.

Totality: total
Visibility: export
deepAlternativesOf : Nat->Genema->GenAlternativesTrueema
  Any depth alternatives fetching.

Alternatives of depth `0` are meant to be a single-item alternatives list with the original generator,
alternatives of depth `1` are those returned by the `alternativesOf` function,
alternatives of depth `n+1` are alternatives of all alternatives of depth `n` being flattened into a single alternatives list.

Totality: total
Visibility: export
forgetAlternatives : Genema->Genema
  Returns generator with internal structure hidden for `alternativesOf`,
except for an empty generator, which would still be returned as an empty generator.

This function must not change distribution when the resulting generator used with usual `Gen` combinators.

Please notice that this function does NOT influence to the result of `deepAlternativesOf`, if depth is increased by 1.

Totality: total
Visibility: export
forgetStructure : Genema->Genema
  Returns generator with internal structure hidden to anything, including combinators,
except for an empty generator, which would still be returned as an empty generator.

Apply with care! Don't use until you understand what you are doing!
Most probably, you need the lighter version of this function called `forgetAlternatives`.
The difference is that `forgetAlternatives` do not influence on the resulting distribution,
when this function may ruin it unexpectedly.

But despite `forgetAlternatives`, this function acts on `deepAlternativesOf`
like `forgetAlternatives` acts on `alternativesOf`,
i.e. `deepAlternativesOf` would give a single alternative for any depth
being applied to the result of this function.

Totality: total
Visibility: export
processAlternatives : (Genema->Genemb) ->Genema->GenAlternativesTrueemb
Totality: total
Visibility: public export
mapAlternativesOf : (a->b) ->Genema->GenAlternativesTrueemb
Totality: total
Visibility: public export
Fixity Declaration: infix operator, level 8
mapAlternativesWith : Genema-> (a->b) ->GenAlternativesTrueemb
Totality: total
Visibility: public export
Fixity Declaration: infix operator, level 8
withAlts : Genema->Genema->Genema
  Associative composition of two generators, merging shallow alternatives of given two generators

This operation being applied to arguments `a` and `b` is *not* the same as `oneOf [a, b]`.
Generator ``a `withAlts` b`` has equal probabilities of all shallow alternatives of generators `a` and `b`.
For example, when there are generators
```idris
g1 = oneOf [elems [0, 1, 2, 3], elems [4, 5]]
g2 = oneOf elemts [10, 11, 12, 13, 14, 15]
```
generator ``g1 `withAlts` g2`` would be equivalent to
`oneOf [elems [0, 1, 2, 3], elems [4, 5], pure 10, pure 11, pure 12, pure 13, pure 14, pure 15]`.

In other words, ``a `withAlts` b`` must be equivalent to `oneOf $ alternativesOf a ++ alternativesOf b`.

Totality: total
Visibility: export
Fixity Declaration: infixr operator, level 2
withDeepAlts : Nat->Genema->Genema->Genema
  Associative composition of two generators, merging deep alternatives of given two generators

This operation being applied to arguments `a` and `b` is *not* the same as `oneOf [a, b]`.
Generator ``a `withDeepAlts` b`` has equal probabilities of all deep alternatives of generators `a` and `b`.
For example, when there are generators
```idris
g1 = oneOf [elems [0, 1, 2, 3], elems [4, 5]]
g2 = oneOf elemts [10, 11, 12, 13, 14, 15]
```
generator ``withDeepAlts n g1 g2`` with `n >= 2` would be equivalent to
`oneOf elements [0, 1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]`.

In other words, ``withDeepAlts d a b`` must be equivalent to `oneOf $ deepAlternativesOf d a ++ deepAlternativesOf d b`.

Totality: total
Visibility: export
mapMaybe : (a->Maybeb) ->Genema->Gen0b
Totality: total
Visibility: export
suchThat_withPrf : Genema-> (p : (a->Bool)) ->Gen0 (Subseta (So.p))
Totality: total
Visibility: export
suchThat : Genema-> (a->Bool) ->Gen0a
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 4
suchThat_dec : Genema-> ((x : a) ->Dec (propx)) ->Gen0 (Subsetaprop)
Totality: total
Visibility: export
suchThat_invertedEq : DecEqb=>Genema-> (y : b) -> (f : (a->b)) ->Gen0 (Subseta (\x=>y=fx))
  Filters the given generator so, that resulting values `x` are solutions of equation `y = f x` for given `f` and `y`.

Totality: total
Visibility: export
retryUntil_withPrf : (p : (a->Bool)) -> (Fuel->Genema) ->Fuel->Gen0 (Subseta (So.p))
  More elegant version of `suchThat_withPrf` for fuelled generators.

Tries to repeat generation until there is some fuel, and fallback to `suchThat_withPrf` in case there isn't.

Totality: total
Visibility: export
retryUntil : (a->Bool) -> (Fuel->Genema) ->Fuel->Gen0a
  More elegant version of `suchThat` for fuelled generators.

Tries to repeat generation until there is some fuel, and fallback to `suchThat` in case there isn't.

Totality: total
Visibility: public export
retryUntil_dec : ((x : a) ->Dec (propx)) -> (Fuel->Genema) ->Fuel->Gen0 (Subsetaprop)
  More elegant version of `suchThat_dec` for fuelled generators.

Tries to repeat generation until there is some fuel, and fallback to `suchThat_dec` in case there isn't.

Totality: total
Visibility: export
variant : Nat->Genema->Genema
Totality: total
Visibility: export
listOf : {default (choose (0, 10)) _ : GenemNat} ->Genema->Genem (Lista)
Totality: total
Visibility: export
vectOf : Genema->Genem (Vectna)
Totality: total
Visibility: export
+

Test.DepTyCheck.Gen

(source)

Reexports

importpublic Control.Monad.Error.Interface
importpublic Control.Monad.Random.Interface
importpublic Control.Monad.State.Interface
importpublic Data.CheckedEmpty.List.Lazy
importpublic Data.Nat1
importpublic Language.Implicits.IfUnsolved
importpublic Test.DepTyCheck.Gen.Emptiness
importpublic Test.DepTyCheck.Gen.Labels

Definitions

wrapLazy : (a->b) -> Lazy a-> Lazy b
Totality: total
Visibility: public export
dataGen : Emptiness->Type->Type
Totality: total
Visibility: export
Constructors:
Empty : GenMaybeEmptya
Pure : a->Genema
Raw : RawGena->Genema
OneOf : alem `NoWeaker` em=>NotImmediatelyEmptyalem=>GenAlternativesTruealema->Genema
Bind : {auto0_ : BindToOuterbiemem} ->RawGenc-> (c->Genbiema) ->Genema
Labelled : Label->Genema->Genema

Hints:
Applicative (Genem)
Functor (Genem)
Monad (Genem)
recordGenAlternatives : (0_ : Bool) ->Emptiness->Type->Type
Totality: total
Visibility: export
Constructor: 
MkGenAlts : LazyLstmustBeNotEmpty (Nat1, Lazy (Genema)) ->GenAlternativesmustBeNotEmptyema

Projection: 
.unGenAlts : GenAlternativesmustBeNotEmptyema->LazyLstmustBeNotEmpty (Nat1, Lazy (Genema))

Hints:
Alternative (GenAlternativesFalseem)
Applicative (GenAlternativesneem)
Cast (LazyLstnea) (GenAlternativesneema)
Functor (GenAlternativesneem)
Monad (GenAlternativesTrueem)
Gen1 : Type->Type
Totality: total
Visibility: public export
Gen0 : Type->Type
  Generator with least guarantees on emptiness.

This type should not be used as an input argument unless it is strictly required.
You should prefer to be polymorphic on emptiness instead.

Totality: total
Visibility: public export
chooseAny : Randoma=> {auto0_ : IfUnsolvedneNonEmpty} ->Gennea
Totality: total
Visibility: export
chooseAnyOf : (0a : Type) ->Randoma=> {auto0_ : IfUnsolvedneNonEmpty} ->Gennea
Totality: total
Visibility: public export
choose : Randoma=> {auto0_ : IfUnsolvedneNonEmpty} -> (a, a) ->Gennea
Totality: total
Visibility: export
empty : Gen0a
Totality: total
Visibility: export
label : Label->Genema->Genema
Totality: total
Visibility: export
dataEquiv : Genlema->Genrema->Type
Totality: total
Visibility: export
Constructors:
EE : EquivEmptyEmpty
EP : Equiv (Purex) (Purex)
ER : Equiv (Rawx) (Rawx)
EO : AltsEquivlgsrgs=>Equiv (OneOf (MkGenAltslgs)) (OneOf (MkGenAltsrgs))
EB : Equiv (Bindxg) (Bindxg)
relax : iem `NoWeaker` em=>Geniema->Genema
Totality: total
Visibility: export
strengthen : Geniema->Maybe (Genema)
Totality: total
Visibility: export
unGen1 : MonadRandomm=>CanManageLabelsm=>Gen1a->ma
Totality: total
Visibility: export
unGenAll' : RandomGeng=>g->Gen1a->Stream (g, a)
Totality: total
Visibility: export
unGenAll : RandomGeng=>g->Gen1a->Streama
Totality: total
Visibility: export
pick1 : CanInitSeedgm=>Functorm=>Gen1a->ma
  Picks one random value from a generator

Totality: total
Visibility: export
unGen : MonadRandomm=>MonadError () m=>CanManageLabelsm=>Genema->ma
Totality: total
Visibility: export
unGen' : MonadRandomm=>CanManageLabelsm=>Genema->m (Maybea)
Totality: total
Visibility: export
unGenTryAll' : RandomGeng=>g->Genema->Stream (g, Maybea)
Totality: total
Visibility: export
unGenTryAll : RandomGeng=>g->Genema->Stream (Maybea)
Totality: total
Visibility: export
unGenTryN : RandomGeng=>Nat->g->Genema->LazyLista
Totality: total
Visibility: export
pick : CanInitSeedgm=>Functorm=>Genema->m (Maybea)
  Tries once to pick a random value from a generator

Totality: total
Visibility: export
pickTryN : CanInitSeedgm=>Functorm=> (n : Nat) ->Genema->m (Maybe (Finn, a))
  Tries to pick a random value from a generator, returning the number of unsuccessful attempts, if generated successfully

Totality: total
Visibility: export
Nil : GenAlternativesFalseema
Totality: total
Visibility: export
(::) : lem `NoWeaker` em=>rem `NoWeaker` em=> {auto0_ : IfUnsolvedeTrue} -> {auto0_ : IfUnsolvedemNonEmpty} -> {auto0_ : IfUnsolvedlemem} -> {auto0_ : IfUnsolvedremem} -> Lazy (Genlema) -> Lazy (GenAlternativeserema) ->GenAlternativesneema
Totality: total
Visibility: export
Fixity Declaration: infixr operator, level 7
(++) : lem `NoWeaker` em=>rem `NoWeaker` em=> {auto0_ : IfUnsolvedlemem} -> {auto0_ : IfUnsolvedremem} -> {auto0_ : IfUnsolvednelFalse} -> {auto0_ : IfUnsolvednerFalse} ->GenAlternativesnellema-> Lazy (GenAlternativesnerrema) ->GenAlternatives (nel|| Delay ner) ema
Totality: total
Visibility: public export
Fixity Declaration: infixr operator, level 7
length : GenAlternativesneema->Nat
Totality: total
Visibility: public export
processAlternatives : (Genema->Genemb) ->GenAlternativesneema->GenAlternativesneemb
Totality: total
Visibility: export
processAlternativesMaybe : (Genema->Maybe (Lazy (Genemb))) ->GenAlternativesneema->GenAlternativesFalseemb
Totality: total
Visibility: export
processAlternatives'' : (Genema->GenAlternativesnebemb) ->GenAlternativesneaema->GenAlternatives (nea&& Delay neb) emb
Totality: total
Visibility: export
processAlternatives' : (Genema->GenAlternativesneemb) ->GenAlternativesneema->GenAlternativesneemb
Totality: total
Visibility: export
relax : GenAlternativesTrueema->GenAlternativesneema
Totality: total
Visibility: export
strengthen : GenAlternativesneema->Maybe (GenAlternativesTrueema)
Totality: total
Visibility: export
altsFromList : LazyLstnea->GenAlternativesneema
Totality: total
Visibility: public export
dataAltsNonEmpty : Bool->Emptiness->Type
Totality: total
Visibility: public export
Constructors:
NT : AltsNonEmptyTrueNonEmpty
DT : AltsNonEmptyTrueMaybeEmptyDeep
Sx : AltsNonEmptyaltsNeMaybeEmpty
altsNonEmptyTrue : AltsNonEmptyTrueem
Totality: total
Visibility: export
oneOf : alem `NoWeaker` em=>AltsNonEmptyaltsNeem=> {auto0_ : IfUnsolvedalemem} -> {auto0_ : IfUnsolvedaltsNe (em/=MaybeEmpty)} ->GenAlternativesaltsNealema->Genema
  Choose one of the given generators uniformly.

All the given generators are treated as independent, i.e. `oneOf [oneOf [a, b], c]` is not the same as `oneOf [a, b, c]`.
In this example case, generator `oneOf [a, b]` and generator `c` will have the same probability in the resulting generator.

Totality: total
Visibility: export
frequency : alem `NoWeaker` em=>AltsNonEmptyaltsNeem=> {auto0_ : IfUnsolvedalemem} -> {auto0_ : IfUnsolvedaltsNe (em/=MaybeEmpty)} ->LazyLstaltsNe (Nat1, Lazy (Genalema)) ->Genema
  Choose one of the given generators with probability proportional to the given value, treating all source generators independently.

This function treats given generators in the same way as `oneOf` do, but the resulting generator uses generator
from the given list the more frequently, the higher number is has.
If generator `g1` has the frequency `n1` and generator `g2` has the frequency `n2`, than `g1` will be used `n1/n2` times
more frequently than `g2` in the resulting generator (in case when `g1` and `g2` always generate some value).

Totality: total
Visibility: export
elements : AltsNonEmptyaltsNeem=> {auto0_ : IfUnsolvedemNonEmpty} -> {auto0_ : IfUnsolvedaltsNe (em/=MaybeEmpty)} ->LazyLstaltsNea->Genema
  Choose one of the given values uniformly.

This function is equivalent to `oneOf` applied to list of `pure` generators per each value.

Totality: total
Visibility: export
elements' : Foldablef=> {auto0_ : IfUnsolvedfList} ->fa->Gen0a
Totality: total
Visibility: export
alternativesOf : Genema->GenAlternativesTrueema
  Shallow alternatives of a generator.

If the given generator is made by one of `oneOf`, `frequency` or `elements`,
this function returns alternatives which this generators contains.
Otherwise it retuns a single-element alternative list containing given generator.

In a sense, this function is a reverse function of `oneOf`, i.g.
`oneOf $ alternativesOf g` must be equivalent to `g` and
`alternativesof $ oneOf gs` must be equivalent to `gs`.

Totality: total
Visibility: export
deepAlternativesOf : Nat->Genema->GenAlternativesTrueema
  Any depth alternatives fetching.

Alternatives of depth `0` are meant to be a single-item alternatives list with the original generator,
alternatives of depth `1` are those returned by the `alternativesOf` function,
alternatives of depth `n+1` are alternatives of all alternatives of depth `n` being flattened into a single alternatives list.

Totality: total
Visibility: export
forgetAlternatives : Genema->Genema
  Returns generator with internal structure hidden for `alternativesOf`,
except for an empty generator, which would still be returned as an empty generator.

This function must not change distribution when the resulting generator used with usual `Gen` combinators.

Please notice that this function does NOT influence to the result of `deepAlternativesOf`, if depth is increased by 1.

Totality: total
Visibility: export
forgetStructure : Genema->Genema
  Returns generator with internal structure hidden to anything, including combinators,
except for an empty generator, which would still be returned as an empty generator.

Apply with care! Don't use until you understand what you are doing!
Most probably, you need the lighter version of this function called `forgetAlternatives`.
The difference is that `forgetAlternatives` do not influence on the resulting distribution,
when this function may ruin it unexpectedly.

But despite `forgetAlternatives`, this function acts on `deepAlternativesOf`
like `forgetAlternatives` acts on `alternativesOf`,
i.e. `deepAlternativesOf` would give a single alternative for any depth
being applied to the result of this function.

Totality: total
Visibility: export
processAlternatives : (Genema->Genemb) ->Genema->GenAlternativesTrueemb
Totality: total
Visibility: public export
mapAlternativesOf : (a->b) ->Genema->GenAlternativesTrueemb
Totality: total
Visibility: public export
Fixity Declaration: infix operator, level 8
mapAlternativesWith : Genema-> (a->b) ->GenAlternativesTrueemb
Totality: total
Visibility: public export
Fixity Declaration: infix operator, level 8
withAlts : Genema->Genema->Genema
  Associative composition of two generators, merging shallow alternatives of given two generators

This operation being applied to arguments `a` and `b` is *not* the same as `oneOf [a, b]`.
Generator ``a `withAlts` b`` has equal probabilities of all shallow alternatives of generators `a` and `b`.
For example, when there are generators
```idris
g1 = oneOf [elems [0, 1, 2, 3], elems [4, 5]]
g2 = oneOf elemts [10, 11, 12, 13, 14, 15]
```
generator ``g1 `withAlts` g2`` would be equivalent to
`oneOf [elems [0, 1, 2, 3], elems [4, 5], pure 10, pure 11, pure 12, pure 13, pure 14, pure 15]`.

In other words, ``a `withAlts` b`` must be equivalent to `oneOf $ alternativesOf a ++ alternativesOf b`.

Totality: total
Visibility: export
Fixity Declaration: infixr operator, level 2
withDeepAlts : Nat->Genema->Genema->Genema
  Associative composition of two generators, merging deep alternatives of given two generators

This operation being applied to arguments `a` and `b` is *not* the same as `oneOf [a, b]`.
Generator ``a `withDeepAlts` b`` has equal probabilities of all deep alternatives of generators `a` and `b`.
For example, when there are generators
```idris
g1 = oneOf [elems [0, 1, 2, 3], elems [4, 5]]
g2 = oneOf elemts [10, 11, 12, 13, 14, 15]
```
generator ``withDeepAlts n g1 g2`` with `n >= 2` would be equivalent to
`oneOf elements [0, 1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15]`.

In other words, ``withDeepAlts d a b`` must be equivalent to `oneOf $ deepAlternativesOf d a ++ deepAlternativesOf d b`.

Totality: total
Visibility: export
mapMaybe : (a->Maybeb) ->Genema->Gen0b
Totality: total
Visibility: export
suchThat_withPrf : Genema-> (p : (a->Bool)) ->Gen0 (Subseta (So.p))
Totality: total
Visibility: export
suchThat : Genema-> (a->Bool) ->Gen0a
Totality: total
Visibility: public export
Fixity Declaration: infixl operator, level 4
suchThat_dec : Genema-> ((x : a) ->Dec (propx)) ->Gen0 (Subsetaprop)
Totality: total
Visibility: export
suchThat_invertedEq : DecEqb=>Genema-> (y : b) -> (f : (a->b)) ->Gen0 (Subseta (\x=>y=fx))
  Filters the given generator so, that resulting values `x` are solutions of equation `y = f x` for given `f` and `y`.

Totality: total
Visibility: export
retryUntil_withPrf : (p : (a->Bool)) -> (Fuel->Genema) ->Fuel->Gen0 (Subseta (So.p))
  More elegant version of `suchThat_withPrf` for fuelled generators.

Tries to repeat generation until there is some fuel, and fallback to `suchThat_withPrf` in case there isn't.

Totality: total
Visibility: export
retryUntil : (a->Bool) -> (Fuel->Genema) ->Fuel->Gen0a
  More elegant version of `suchThat` for fuelled generators.

Tries to repeat generation until there is some fuel, and fallback to `suchThat` in case there isn't.

Totality: total
Visibility: public export
retryUntil_dec : ((x : a) ->Dec (propx)) -> (Fuel->Genema) ->Fuel->Gen0 (Subsetaprop)
  More elegant version of `suchThat_dec` for fuelled generators.

Tries to repeat generation until there is some fuel, and fallback to `suchThat_dec` in case there isn't.

Totality: total
Visibility: export
variant : Nat->Genema->Genema
Totality: total
Visibility: export
listOf : {default (choose (0, 10)) _ : GenemNat} ->Genema->Genem (Lista)
Totality: total
Visibility: export
vectOf : Genema->Genem (Vectna)
Totality: total
Visibility: export
diff --git a/docs/linux/docs/docs/System.Linux.Inotify.Flags.html b/docs/linux/docs/docs/System.Linux.Inotify.Flags.html index d6655b5c0..8e65f495c 100644 --- a/docs/linux/docs/docs/System.Linux.Inotify.Flags.html +++ b/docs/linux/docs/docs/System.Linux.Inotify.Flags.html @@ -61,4 +61,4 @@ -

System.Linux.Inotify.Flags

(source)

Definitions

recordInotifyFlags : Type
Totality: total
Visibility: public export
Constructor: 
IF : Bits32->InotifyFlags

Projection: 
.flags : InotifyFlags->Bits32

Hints:
EqInotifyFlags
MonoidInotifyFlags
OrdInotifyFlags
SemigroupInotifyFlags
ShowInotifyFlags
.flags : InotifyFlags->Bits32
Totality: total
Visibility: public export
flags : InotifyFlags->Bits32
Totality: total
Visibility: public export
recordInotifyMask : Type
Totality: total
Visibility: public export
Constructor: 
IM : Bits32->InotifyMask

Projection: 
.mask : InotifyMask->Bits32

Hints:
EqInotifyMask
MonoidInotifyMask
OrdInotifyMask
SemigroupInotifyMask
ShowInotifyMask
.mask : InotifyMask->Bits32
Totality: total
Visibility: public export
mask : InotifyMask->Bits32
Totality: total
Visibility: public export
has : InotifyMask->InotifyMask->Bool
  Checks if an inotify event mask holds the given event.

Totality: total
Visibility: export
IN_NONBLOCK : InotifyFlags
Totality: total
Visibility: public export
IN_CLOEXEC : InotifyFlags
Totality: total
Visibility: public export
IN_ACCESS : InotifyMask
Totality: total
Visibility: public export
IN_ATTRIB : InotifyMask
Totality: total
Visibility: public export
IN_CLOSE_WRITE : InotifyMask
Totality: total
Visibility: public export
IN_CLOSE_NOWRITE : InotifyMask
Totality: total
Visibility: public export
IN_CREATE : InotifyMask
Totality: total
Visibility: public export
IN_DELETE : InotifyMask
Totality: total
Visibility: public export
IN_DELETE_SELF : InotifyMask
Totality: total
Visibility: public export
IN_MODIFY : InotifyMask
Totality: total
Visibility: public export
IN_MOVE_SELF : InotifyMask
Totality: total
Visibility: public export
IN_MOVED_FROM : InotifyMask
Totality: total
Visibility: public export
IN_MOVED_TO : InotifyMask
Totality: total
Visibility: public export
IN_OPEN : InotifyMask
Totality: total
Visibility: public export
IN_ALL_EVENTS : InotifyMask
Totality: total
Visibility: public export
IN_MOVE : InotifyMask
Totality: total
Visibility: public export
IN_CLOSE : InotifyMask
Totality: total
Visibility: public export
IN_DONT_FOLLOW : InotifyMask
Totality: total
Visibility: public export
Totality: total
Visibility: public export
IN_MASK_ADD : InotifyMask
Totality: total
Visibility: public export
IN_ONESHOT : InotifyMask
Totality: total
Visibility: public export
IN_ONLYDIR : InotifyMask
Totality: total
Visibility: public export
IN_MASK_CREATE : InotifyMask
Totality: total
Visibility: public export
IN_IGNORED : InotifyMask
Totality: total
Visibility: public export
IN_ISDIR : InotifyMask
Totality: total
Visibility: public export
IN_Q_OVERFLOW : InotifyMask
Totality: total
Visibility: public export
IN_UNMOUNT : InotifyMask
Totality: total
Visibility: public export
+

System.Linux.Inotify.Flags

(source)

Definitions

recordInotifyFlags : Type
Totality: total
Visibility: public export
Constructor: 
IF : Bits32->InotifyFlags

Projection: 
.flags : InotifyFlags->Bits32

Hints:
EqInotifyFlags
MonoidInotifyFlags
OrdInotifyFlags
SemigroupInotifyFlags
ShowInotifyFlags
.flags : InotifyFlags->Bits32
Totality: total
Visibility: public export
flags : InotifyFlags->Bits32
Totality: total
Visibility: public export
recordInotifyMask : Type
Totality: total
Visibility: public export
Constructor: 
IM : Bits32->InotifyMask

Projection: 
.mask : InotifyMask->Bits32

Hints:
EqInotifyMask
MonoidInotifyMask
OrdInotifyMask
SemigroupInotifyMask
ShowInotifyMask
.mask : InotifyMask->Bits32
Totality: total
Visibility: public export
mask : InotifyMask->Bits32
Totality: total
Visibility: public export
has : InotifyMask->InotifyMask->Bool
  Checks if an inotify event mask holds the given event.

Totality: total
Visibility: export
IN_NONBLOCK : InotifyFlags
Totality: total
Visibility: public export
IN_CLOEXEC : InotifyFlags
Totality: total
Visibility: public export
IN_ACCESS : InotifyMask
Totality: total
Visibility: public export
IN_ATTRIB : InotifyMask
Totality: total
Visibility: public export
IN_CLOSE_WRITE : InotifyMask
Totality: total
Visibility: public export
IN_CLOSE_NOWRITE : InotifyMask
Totality: total
Visibility: public export
IN_CREATE : InotifyMask
Totality: total
Visibility: public export
IN_DELETE : InotifyMask
Totality: total
Visibility: public export
IN_DELETE_SELF : InotifyMask
Totality: total
Visibility: public export
IN_MODIFY : InotifyMask
Totality: total
Visibility: public export
IN_MOVE_SELF : InotifyMask
Totality: total
Visibility: public export
IN_MOVED_FROM : InotifyMask
Totality: total
Visibility: public export
IN_MOVED_TO : InotifyMask
Totality: total
Visibility: public export
IN_OPEN : InotifyMask
Totality: total
Visibility: public export
IN_ALL_EVENTS : InotifyMask
Totality: total
Visibility: public export
IN_MOVE : InotifyMask
Totality: total
Visibility: public export
IN_CLOSE : InotifyMask
Totality: total
Visibility: public export
IN_DONT_FOLLOW : InotifyMask
Totality: total
Visibility: public export
Totality: total
Visibility: public export
IN_MASK_ADD : InotifyMask
Totality: total
Visibility: public export
IN_ONESHOT : InotifyMask
Totality: total
Visibility: public export
IN_ONLYDIR : InotifyMask
Totality: total
Visibility: public export
IN_MASK_CREATE : InotifyMask
Totality: total
Visibility: public export
IN_IGNORED : InotifyMask
Totality: total
Visibility: public export
IN_ISDIR : InotifyMask
Totality: total
Visibility: public export
IN_Q_OVERFLOW : InotifyMask
Totality: total
Visibility: public export
IN_UNMOUNT : InotifyMask
Totality: total
Visibility: public export
diff --git a/docs/linux/docs/docs/System.Linux.Inotify.html b/docs/linux/docs/docs/System.Linux.Inotify.html index f932c311b..b55df09e0 100644 --- a/docs/linux/docs/docs/System.Linux.Inotify.html +++ b/docs/linux/docs/docs/System.Linux.Inotify.html @@ -61,4 +61,4 @@ -

System.Linux.Inotify

(source)

Reexports

importpublic System.Linux.Inotify.Flags
importpublic System.Posix.File

Definitions

recordInotify : Type
  An `inotify` file descriptor.

Totality: total
Visibility: export
Constructor: 
I : Bits32->Inotify

Projection: 
.fd : Inotify->Bits32

Hints:
CastInotifyFd
EqInotify
OrdInotify
ShowInotify
recordWatch : Type
  An `inotify` file descriptor.

Totality: total
Visibility: export
Constructor: 
W : Bits32->Watch

Projection: 
.wd : Watch->Bits32

Hints:
EqWatch
InterpolationWatch
OrdWatch
ShowWatch
recordInotifyRes : Type
Totality: total
Visibility: public export
Constructor: 
IR : Watch->InotifyMask->Bits32->String->InotifyRes

Projections:
.cookie : InotifyRes->Bits32
.mask : InotifyRes->InotifyMask
.name : InotifyRes->String
.watch : InotifyRes->Watch

Hints:
EqInotifyRes
ShowInotifyRes
.watch : InotifyRes->Watch
Totality: total
Visibility: public export
watch : InotifyRes->Watch
Totality: total
Visibility: public export
.mask : InotifyRes->InotifyMask
Totality: total
Visibility: public export
mask : InotifyRes->InotifyMask
Totality: total
Visibility: public export
.cookie : InotifyRes->Bits32
Totality: total
Visibility: public export
cookie : InotifyRes->Bits32
Totality: total
Visibility: public export
.name : InotifyRes->String
Totality: total
Visibility: public export
name : InotifyRes->String
Totality: total
Visibility: public export
inotifyInit : InotifyFlags->IO (EitherErrnoInotify)
  Opens a new `inotify` file descriptor.

Totality: total
Visibility: export
inotifyAddWatch : Inotify->String->InotifyMask->IO (EitherErrnoWatch)
  Watches a file for the given events.

Totality: total
Visibility: export
inotifyRm : Inotify->Watch->IO (EitherErrno ())
Totality: total
Visibility: export
inotifyRead : Bits32->Inotify->IO (EitherErrno (ListInotifyRes))
  Reads at most `buf` from an `inotify` file descriptor.

This will block the

Totality: total
Visibility: export
+

System.Linux.Inotify

(source)

Reexports

importpublic System.Linux.Inotify.Flags
importpublic System.Posix.File

Definitions

recordInotify : Type
  An `inotify` file descriptor.

Totality: total
Visibility: export
Constructor: 
I : Bits32->Inotify

Projection: 
.fd : Inotify->Bits32

Hints:
CastInotifyFd
EqInotify
OrdInotify
ShowInotify
recordWatch : Type
  An `inotify` file descriptor.

Totality: total
Visibility: export
Constructor: 
W : Bits32->Watch

Projection: 
.wd : Watch->Bits32

Hints:
EqWatch
InterpolationWatch
OrdWatch
ShowWatch
recordInotifyRes : Type
Totality: total
Visibility: public export
Constructor: 
IR : Watch->InotifyMask->Bits32->String->InotifyRes

Projections:
.cookie : InotifyRes->Bits32
.mask : InotifyRes->InotifyMask
.name : InotifyRes->String
.watch : InotifyRes->Watch

Hints:
EqInotifyRes
ShowInotifyRes
.watch : InotifyRes->Watch
Totality: total
Visibility: public export
watch : InotifyRes->Watch
Totality: total
Visibility: public export
.mask : InotifyRes->InotifyMask
Totality: total
Visibility: public export
mask : InotifyRes->InotifyMask
Totality: total
Visibility: public export
.cookie : InotifyRes->Bits32
Totality: total
Visibility: public export
cookie : InotifyRes->Bits32
Totality: total
Visibility: public export
.name : InotifyRes->String
Totality: total
Visibility: public export
name : InotifyRes->String
Totality: total
Visibility: public export
inotifyInit : ErrIOio=>InotifyFlags->ioInotify
  Opens a new `inotify` file descriptor.

Totality: total
Visibility: export
inotifyAddWatch : ErrIOio=>Inotify->String->InotifyMask->ioWatch
  Watches a file for the given events.

Totality: total
Visibility: export
inotifyRm : ErrIOio=>Inotify->Watch->io ()
Totality: total
Visibility: export
inotifyRead : ErrIOio=>Bits32->Inotify->io (ListInotifyRes)
  Reads at most `buf` from an `inotify` file descriptor.

This will block the

Totality: total
Visibility: export
diff --git a/docs/linux/docs/docs/System.Linux.Inotify.src.html b/docs/linux/docs/docs/System.Linux.Inotify.src.html index 400e81df7..c19336909 100644 --- a/docs/linux/docs/docs/System.Linux.Inotify.src.html +++ b/docs/linux/docs/docs/System.Linux.Inotify.src.html @@ -198,16 +198,16 @@
 77 |
 78 | ||| Opens a new `inotify` file descriptor.
 79 | export %inline
-
 80 | inotifyInit : InotifyFlags -> IO (Either Errno Inotify)
+
 80 | inotifyInit : ErrIO io => InotifyFlags -> io Inotify
 81 | inotifyInit (IF f) = toVal (I . cast) $ prim__inotify_init1 f
 82 |
 83 | ||| Watches a file for the given events.
 84 | export %inline
-
 85 | inotifyAddWatch : Inotify -> String -> InotifyMask -> IO (Either Errno Watch)
+
 85 | inotifyAddWatch : ErrIO io => Inotify -> String -> InotifyMask -> io Watch
 86 | inotifyAddWatch (I f) s (IM m) = toVal (W . cast) $ prim__inotify_add_watch f s m
 87 |
 88 | export %inline
-
 89 | inotifyRm : Inotify -> Watch -> IO (Either Errno ())
+
 89 | inotifyRm : ErrIO io => Inotify -> Watch -> io ()
 90 | inotifyRm (I f) (W w) = toUnit $ prim__inotify_rm f w
 91 |
 92 | results : SnocList InotifyRes -> AnyPtr -> AnyPtr -> Bits32 -> List InotifyRes
@@ -216,35 +216,34 @@
 95 | |||
 96 | ||| This will block the
 97 | export
-
 98 | inotifyRead : (buf : Bits32) -> Inotify -> IO (Either Errno $ List InotifyRes)
+
 98 | inotifyRead : ErrIO io => (buf : Bits32) -> Inotify -> io (List InotifyRes)
 99 | inotifyRead buf i =
-
100 |   withPtr (cast buf) $ \p => readPtr i p buf >>= \case
-
101 |     Left x  => pure (Left x)
-
102 |     Right x => pure (Right $ results [<] p p x)
-
103 |
-
104 | --------------------------------------------------------------------------------
-
105 | -- Extracting Results
-
106 | --------------------------------------------------------------------------------
-
107 |
-
108 | reslt : AnyPtr -> InotifyRes
-
109 | reslt p =
-
110 |   IR
-
111 |     { watch  = W $ prim__inotify_wd p
-
112 |     , mask   = IM $ prim__inotify_mask p
-
113 |     , cookie = prim__inotify_cookie p
-
114 |     , name   = ""
-
115 |     }
-
116 |
-
117 | results sx orig cur sz =
-
118 |   case prim__inotify_more orig cur sz of
-
119 |     0 => sx <>> []
-
120 |     _ =>
-
121 |       results
-
122 |         (sx :< reslt cur)
-
123 |         orig
-
124 |         (assert_smaller cur $ prim__inotify_next cur)
-
125 |         sz
-
126 |
+
100 |   withPtr (cast buf) $ \p => readPtr i p buf >>= \x =>
+
101 |     pure (results [<] p p x)
+
102 |
+
103 | --------------------------------------------------------------------------------
+
104 | -- Extracting Results
+
105 | --------------------------------------------------------------------------------
+
106 |
+
107 | reslt : AnyPtr -> InotifyRes
+
108 | reslt p =
+
109 |   IR
+
110 |     { watch  = W $ prim__inotify_wd p
+
111 |     , mask   = IM $ prim__inotify_mask p
+
112 |     , cookie = prim__inotify_cookie p
+
113 |     , name   = ""
+
114 |     }
+
115 |
+
116 | results sx orig cur sz =
+
117 |   case prim__inotify_more orig cur sz of
+
118 |     0 => sx <>> []
+
119 |     _ =>
+
120 |       results
+
121 |         (sx :< reslt cur)
+
122 |         orig
+
123 |         (assert_smaller cur $ prim__inotify_next cur)
+
124 |         sz
+
125 |
diff --git a/docs/linux/docs/docs/System.Linux.Pipe.html b/docs/linux/docs/docs/System.Linux.Pipe.html new file mode 100644 index 000000000..ccbdc7b3c --- /dev/null +++ b/docs/linux/docs/docs/System.Linux.Pipe.html @@ -0,0 +1,64 @@ + + + + + System.Linux.Pipe + + + + + +
+ Idris2Doc : System.Linux.Pipe + + + + +
+

System.Linux.Pipe

(source)

Reexports

importpublic System.Posix.Pipe

Definitions

O_DIRECT : Flags
  With this flag set, a pipe will treat every `write` as a distinct data
package, and `read` will read one package at a time.

Note, that when writing more than `PIPE_BUF` bytes at a time, the data
will be split into smaller packages.

Totality: total
Visibility: export
pipe2 : ErrIOio=>CArrayIO2Fd->Flags->io ()
  Linux-specific version of `pipe` that allows setting additional
flags (`O_NONBLOCK`, `O_CLOEXEC`, `O_DIRECT`).

Totality: total
Visibility: export
diff --git a/docs/linux/docs/docs/System.Linux.Pipe.src.html b/docs/linux/docs/docs/System.Linux.Pipe.src.html new file mode 100644 index 000000000..e24a3a82f --- /dev/null +++ b/docs/linux/docs/docs/System.Linux.Pipe.src.html @@ -0,0 +1,158 @@ + + + + + + + + + +
 0 | module System.Linux.Pipe
+
 1 |
+
 2 | import public System.Posix.Pipe
+
 3 |
+
 4 | %default total
+
 5 |
+
 6 | --------------------------------------------------------------------------------
+
 7 | -- FFI
+
 8 | --------------------------------------------------------------------------------
+
 9 |
+
10 | %foreign "C:li_pipe2, linux-idris"
+
11 | prim__pipe2 : AnyPtr -> Bits32 -> PrimIO CInt
+
12 |
+
13 | %foreign "C:li_o_direct, linux-idris"
+
14 | o_direct : Bits32
+
15 |
+
16 | ||| With this flag set, a pipe will treat every `write` as a distinct data
+
17 | ||| package, and `read` will read one package at a time.
+
18 | |||
+
19 | ||| Note, that when writing more than `PIPE_BUF` bytes at a time, the data
+
20 | ||| will be split into smaller packages.
+
21 | export %inline
+
22 | O_DIRECT : Flags
+
23 | O_DIRECT = F o_direct
+
24 |
+
25 | --------------------------------------------------------------------------------
+
26 | -- API
+
27 | --------------------------------------------------------------------------------
+
28 |
+
29 | ||| Linux-specific version of `pipe` that allows setting additional
+
30 | ||| flags (`O_NONBLOCK`, `O_CLOEXEC`, `O_DIRECT`).
+
31 | export %inline
+
32 | pipe2 : ErrIO io => CArrayIO 2 Fd -> Flags -> io ()
+
33 | pipe2 p (F fs) = toUnit $ prim__pipe2 (unsafeUnwrap p) fs
+
34 |
+
+ + diff --git a/docs/linux/docs/docs/System.Linux.Pthreads.html b/docs/linux/docs/docs/System.Linux.Pthreads.html new file mode 100644 index 000000000..3ee5c4a98 --- /dev/null +++ b/docs/linux/docs/docs/System.Linux.Pthreads.html @@ -0,0 +1,64 @@ + + + + + System.Linux.Pthreads + + + + + +
+ Idris2Doc : System.Linux.Pthreads + + + + +
+

System.Linux.Pthreads

(source)

Reexports

importpublic System.Posix.Pthreads

Definitions

pthreadSigqueue : ErrIOio=>PthreadT->Signal->CInt->io ()
  Sends a realtime signal plus data word to a thread.

Note that `sig` must be in the range [SIGRTMIN, SIGRTMAX].

Totality: total
Visibility: export
diff --git a/docs/linux/docs/docs/System.Linux.Pthreads.src.html b/docs/linux/docs/docs/System.Linux.Pthreads.src.html new file mode 100644 index 000000000..4cc1ee39d --- /dev/null +++ b/docs/linux/docs/docs/System.Linux.Pthreads.src.html @@ -0,0 +1,142 @@ + + + + + + + + + +
 0 | module System.Linux.Pthreads
+
 1 |
+
 2 | import Data.C.Ptr
+
 3 | import System.Posix.Signal
+
 4 | import public System.Posix.Pthreads
+
 5 |
+
 6 | %default total
+
 7 |
+
 8 | %foreign "C:li_pthread_sigqueue, posix-idris"
+
 9 | prim__pthread_sigqueue : AnyPtr -> Bits32 -> CInt -> PrimIO Bits32
+
10 |
+
11 | ||| Sends a realtime signal plus data word to a thread.
+
12 | |||
+
13 | ||| Note that `sig` must be in the range [SIGRTMIN, SIGRTMAX].
+
14 | export %inline
+
15 | pthreadSigqueue : ErrIO io => PthreadT -> Signal -> (word : CInt) -> io ()
+
16 | pthreadSigqueue p s word =
+
17 |   posToUnit $ prim__pthread_sigqueue (unwrapPthreadT p) s.sig word
+
18 |
+
+ + diff --git a/docs/linux/docs/docs/System.Linux.Signalfd.Flags.html b/docs/linux/docs/docs/System.Linux.Signalfd.Flags.html index 39dd1231c..0251b07aa 100644 --- a/docs/linux/docs/docs/System.Linux.Signalfd.Flags.html +++ b/docs/linux/docs/docs/System.Linux.Signalfd.Flags.html @@ -61,4 +61,4 @@ -

System.Linux.Signalfd.Flags

(source)

Definitions

recordSignalfdFlags : Type
Totality: total
Visibility: public export
Constructor: 
F : Bits32->SignalfdFlags

Projection: 
.flags : SignalfdFlags->Bits32

Hints:
EqSignalfdFlags
MonoidSignalfdFlags
OrdSignalfdFlags
SemigroupSignalfdFlags
ShowSignalfdFlags
.flags : SignalfdFlags->Bits32
Totality: total
Visibility: public export
flags : SignalfdFlags->Bits32
Totality: total
Visibility: public export
SFD_CLOEXEC : SignalfdFlags
Totality: total
Visibility: public export
SFD_NONBLOCK : SignalfdFlags
Totality: total
Visibility: public export
signalfd_siginfo_size : Nat
Totality: total
Visibility: public export
+

System.Linux.Signalfd.Flags

(source)

Definitions

recordSignalfdFlags : Type
Totality: total
Visibility: public export
Constructor: 
F : Bits32->SignalfdFlags

Projection: 
.flags : SignalfdFlags->Bits32

Hints:
EqSignalfdFlags
MonoidSignalfdFlags
OrdSignalfdFlags
SemigroupSignalfdFlags
ShowSignalfdFlags
.flags : SignalfdFlags->Bits32
Totality: total
Visibility: public export
flags : SignalfdFlags->Bits32
Totality: total
Visibility: public export
SFD_CLOEXEC : SignalfdFlags
Totality: total
Visibility: public export
SFD_NONBLOCK : SignalfdFlags
Totality: total
Visibility: public export
signalfd_siginfo_size : Nat
Totality: total
Visibility: public export
diff --git a/docs/linux/docs/docs/System.Linux.Signalfd.html b/docs/linux/docs/docs/System.Linux.Signalfd.html index 3792c16ff..247f11f37 100644 --- a/docs/linux/docs/docs/System.Linux.Signalfd.html +++ b/docs/linux/docs/docs/System.Linux.Signalfd.html @@ -61,4 +61,4 @@ -

System.Linux.Signalfd

(source)

Reexports

importpublic Data.C.Ptr
importpublic System.Linux.Signalfd.Flags
importpublic System.Posix.File
importpublic System.Posix.Signal

Definitions

recordSignalfd : Type
  A file descriptor for signal handling.

This can be used for synchronous signal handling using
(blocking) `readSignalfd` directly, or for asynchronous signal handling
using `epoll`.

Totality: total
Visibility: export
Constructor: 
SFD : Bits32->Signalfd

Projection: 
.fd : Signalfd->Bits32

Hint: 
CastSignalfdFd
signalfd : SigsetT->SignalfdFlags->IO (EitherErrnoSignalfd)
  Opens a new `signalfd` file descriptor for observing the
signals specified in the given `SigsetT`.


Notes:
* Usually, the signals in `set` should first be blocked via `sigprocmask`.
* A `signalfd` should be closed using `close` just like other file
descriptors.
* In general, use `readSignalfd` instead of the `read` functions
from `System.Posix.File` to read from a `signalfd`.

Totality: total
Visibility: export
recordSiginfoFd : Type
  Result type when reading from a `Signalfd`.

Totality: total
Visibility: export
Constructor: 
SI : AnyPtr->SiginfoFd

Projection: 
.ptr : SiginfoFd->AnyPtr

Hints:
DerefSiginfoFd
SizeOfSiginfoFd
signal : HasIOio=>SiginfoFd->ioSignal
  The signal that was raised

Totality: total
Visibility: export
errno : HasIOio=>SiginfoFd->ioInt32
Totality: total
Visibility: export
code : HasIOio=>SiginfoFd->ioInt32
Totality: total
Visibility: export
pid : HasIOio=>SiginfoFd->ioPidT
  ID of the process that raised the signal.

Totality: total
Visibility: export
uid : HasIOio=>SiginfoFd->ioUidT
  Real user ID of the process that raised the signal.

Totality: total
Visibility: export
fd : HasIOio=>SiginfoFd->ioSignalfd
  File descriptor that caught the signal.

Totality: total
Visibility: export
tid : HasIOio=>SiginfoFd->ioBits32
  ID of the timer that raised the signal.

Totality: total
Visibility: export
band : HasIOio=>SiginfoFd->ioBits32
Totality: total
Visibility: export
overrun : HasIOio=>SiginfoFd->ioBits32
Totality: total
Visibility: export
trapno : HasIOio=>SiginfoFd->ioBits32
Totality: total
Visibility: export
status : HasIOio=>SiginfoFd->ioInt32
Totality: total
Visibility: export
int : HasIOio=>SiginfoFd->ioInt32
  Integer value of a realtime signal.

Totality: total
Visibility: export
ptr : HasIOio=>SiginfoFd->ioBits64
  Pointer value of a realtime signal

Totality: total
Visibility: export
utime : HasIOio=>SiginfoFd->ioBits64
Totality: total
Visibility: export
stime : HasIOio=>SiginfoFd->ioBits64
Totality: total
Visibility: export
addr : HasIOio=>SiginfoFd->ioBits64
Totality: total
Visibility: export
addrlsb : HasIOio=>SiginfoFd->ioBits16
Totality: total
Visibility: export
readSignalfd : Signalfd->CArrayIOnSiginfoFd->IO (EitherErrno (n : Nat**CArrayIOnSiginfoFd))
  Reads data from a `signalfd` into a pre-allocated array.

Note: This will overwrite the data stored in `arr` and the
result is a wrapper around the same pointer.

Totality: total
Visibility: export
+

System.Linux.Signalfd

(source)

Reexports

importpublic Data.C.Ptr
importpublic System.Linux.Signalfd.Flags
importpublic System.Posix.File
importpublic System.Posix.Signal

Definitions

recordSignalfd : Type
  A file descriptor for signal handling.

This can be used for synchronous signal handling using
(blocking) `readSignalfd` directly, or for asynchronous signal handling
using `epoll`.

Totality: total
Visibility: export
Constructor: 
SFD : Bits32->Signalfd

Projection: 
.fd : Signalfd->Bits32

Hint: 
CastSignalfdFd
signalfd : ErrIOio=>SigsetT->SignalfdFlags->ioSignalfd
  Opens a new `signalfd` file descriptor for observing the
signals specified in the given `SigsetT`.


Notes:
* Usually, the signals in `set` should first be blocked via `sigprocmask`.
* A `signalfd` should be closed using `close` just like other file
descriptors.
* In general, use `readSignalfd` instead of the `read` functions
from `System.Posix.File` to read from a `signalfd`.

Totality: total
Visibility: export
recordSiginfoFd : Type
  Result type when reading from a `Signalfd`.

Totality: total
Visibility: export
Constructor: 
SI : AnyPtr->SiginfoFd

Projection: 
.ptr : SiginfoFd->AnyPtr

Hints:
DerefSiginfoFd
SizeOfSiginfoFd
signal : HasIOio=>SiginfoFd->ioSignal
  The signal that was raised

Totality: total
Visibility: export
errno : HasIOio=>SiginfoFd->ioInt32
Totality: total
Visibility: export
code : HasIOio=>SiginfoFd->ioInt32
Totality: total
Visibility: export
pid : HasIOio=>SiginfoFd->ioPidT
  ID of the process that raised the signal.

Totality: total
Visibility: export
uid : HasIOio=>SiginfoFd->ioUidT
  Real user ID of the process that raised the signal.

Totality: total
Visibility: export
fd : HasIOio=>SiginfoFd->ioSignalfd
  File descriptor that caught the signal.

Totality: total
Visibility: export
tid : HasIOio=>SiginfoFd->ioBits32
  ID of the timer that raised the signal.

Totality: total
Visibility: export
band : HasIOio=>SiginfoFd->ioBits32
Totality: total
Visibility: export
overrun : HasIOio=>SiginfoFd->ioBits32
Totality: total
Visibility: export
trapno : HasIOio=>SiginfoFd->ioBits32
Totality: total
Visibility: export
status : HasIOio=>SiginfoFd->ioInt32
Totality: total
Visibility: export
int : HasIOio=>SiginfoFd->ioInt32
  Integer value of a realtime signal.

Totality: total
Visibility: export
ptr : HasIOio=>SiginfoFd->ioBits64
  Pointer value of a realtime signal

Totality: total
Visibility: export
utime : HasIOio=>SiginfoFd->ioBits64
Totality: total
Visibility: export
stime : HasIOio=>SiginfoFd->ioBits64
Totality: total
Visibility: export
addr : HasIOio=>SiginfoFd->ioBits64
Totality: total
Visibility: export
addrlsb : HasIOio=>SiginfoFd->ioBits16
Totality: total
Visibility: export
readSignalfd : ErrIOio=>Signalfd->CArrayIOnSiginfoFd->io (n : Nat**CArrayIOnSiginfoFd)
  Reads data from a `signalfd` into a pre-allocated array.

Note: This will overwrite the data stored in `arr` and the
result is a wrapper around the same pointer.

Totality: total
Visibility: export
diff --git a/docs/linux/docs/docs/System.Linux.Signalfd.src.html b/docs/linux/docs/docs/System.Linux.Signalfd.src.html index 5f0a930f3..10280a5b1 100644 --- a/docs/linux/docs/docs/System.Linux.Signalfd.src.html +++ b/docs/linux/docs/docs/System.Linux.Signalfd.src.html @@ -213,7 +213,7 @@
 92 | ||| * In general, use `readSignalfd` instead of the `read` functions
 93 | |||   from `System.Posix.File` to read from a `signalfd`.
 94 | export %inline
-
 95 | signalfd : (set : SigsetT) -> SignalfdFlags -> IO (Either Errno Signalfd)
+
 95 | signalfd : ErrIO io => (set : SigsetT) -> SignalfdFlags -> io Signalfd
 96 | signalfd set (F f) = toVal (SFD . cast) $ prim__signalfd (unwrap set) f
 97 |
 98 | ||| Result type when reading from a `Signalfd`.
@@ -311,17 +311,18 @@
190 | |||       result is a wrapper around the same pointer.
191 | export
192 | readSignalfd :
-
193 |      {n : _}
-
194 |   -> Signalfd
-
195 |   -> (arr : CArrayIO n SiginfoFd)
-
196 |   -> IO (Either Errno $ (n ** CArrayIO n SiginfoFd))
-
197 | readSignalfd fd arr =
-
198 |   let p  := unsafeUnwrap arr
-
199 |       sz := sizeof SiginfoFd
-
200 |    in readPtr fd p (cast $ n * sz) >>= \case
-
201 |         Left x   => pure (Left x)
-
202 |         Right bs => pure (Right (cast (bs `div` cast sz) ** unsafeWrap p))
-
203 |
+
193 |      {auto has : ErrIO io}
+
194 |   -> {n : _}
+
195 |   -> Signalfd
+
196 |   -> (arr : CArrayIO n SiginfoFd)
+
197 |   -> io (n ** CArrayIO n SiginfoFd)
+
198 | readSignalfd fd arr =
+
199 |   let p  := unsafeUnwrap arr
+
200 |       sz := sizeof SiginfoFd
+
201 |    in do
+
202 |      bs <- readPtr fd p (cast $ n * sz)
+
203 |      pure (cast (bs `div` cast sz) ** unsafeWrap p)
+
204 |
diff --git a/docs/linux/docs/docs/System.Linux.Timerfd.Flags.html b/docs/linux/docs/docs/System.Linux.Timerfd.Flags.html index 7ef78d7e6..4486274f1 100644 --- a/docs/linux/docs/docs/System.Linux.Timerfd.Flags.html +++ b/docs/linux/docs/docs/System.Linux.Timerfd.Flags.html @@ -61,4 +61,4 @@ -

System.Linux.Timerfd.Flags

(source)

Definitions

recordTimerfdFlags : Type
Totality: total
Visibility: public export
Constructor: 
F : Bits32->TimerfdFlags

Projection: 
.flags : TimerfdFlags->Bits32

Hints:
EqTimerfdFlags
MonoidTimerfdFlags
OrdTimerfdFlags
SemigroupTimerfdFlags
ShowTimerfdFlags
.flags : TimerfdFlags->Bits32
Totality: total
Visibility: public export
flags : TimerfdFlags->Bits32
Totality: total
Visibility: public export
TFD_CLOEXEC : TimerfdFlags
Totality: total
Visibility: public export
TFD_NONBLOCK : TimerfdFlags
Totality: total
Visibility: public export
TFD_TIMER_ABSTIME : Bits32
Totality: total
Visibility: public export
+

System.Linux.Timerfd.Flags

(source)

Definitions

recordTimerfdFlags : Type
Totality: total
Visibility: public export
Constructor: 
F : Bits32->TimerfdFlags

Projection: 
.flags : TimerfdFlags->Bits32

Hints:
EqTimerfdFlags
MonoidTimerfdFlags
OrdTimerfdFlags
SemigroupTimerfdFlags
ShowTimerfdFlags
.flags : TimerfdFlags->Bits32
Totality: total
Visibility: public export
flags : TimerfdFlags->Bits32
Totality: total
Visibility: public export
TFD_CLOEXEC : TimerfdFlags
Totality: total
Visibility: public export
TFD_NONBLOCK : TimerfdFlags
Totality: total
Visibility: public export
TFD_TIMER_ABSTIME : Bits32
Totality: total
Visibility: public export
diff --git a/docs/linux/docs/docs/System.Linux.Timerfd.html b/docs/linux/docs/docs/System.Linux.Timerfd.html index 792e0e686..3931cf180 100644 --- a/docs/linux/docs/docs/System.Linux.Timerfd.html +++ b/docs/linux/docs/docs/System.Linux.Timerfd.html @@ -61,4 +61,4 @@ -

System.Linux.Timerfd

(source)

Reexports

importpublic Data.C.Ptr
importpublic System.Linux.Timerfd.Flags
importpublic System.Posix.File
importpublic System.Posix.Timer

Definitions

recordTimerfd : Type
  A file descriptor for signal handling.

This can be used for synchronous signal handling using
(blocking) `readSignalfd` directly, or for asynchronous signal handling
using `epoll`.

Totality: total
Visibility: export
Constructor: 
TFD : Bits32->Timerfd

Projection: 
.fd : Timerfd->Bits32

Hint: 
CastTimerfdFd
timerfd : ClockId->TimerfdFlags->IO (EitherErrnoTimerfd)
  Opens a new `timerfd` file descriptor for observing the given clock.


Notes:
* A `signalfd` should be closed using `close` just like other file
descriptors.
* In general, use `readTimerfd` instead of the `read` functions
from `System.Posix.File` to read from a `timerfd`.

Totality: total
Visibility: export
settime : Timerfd->Bits32->Itimerspec->Itimerspec->IO (EitherErrno ())
  Sets the time of a `timerfd`.

The currently set time will be stored in `old`.
Use the `TFD_TIMER_ABSTIME` flag if the time should be interpreted as
an absolute wall clock time.

Totality: total
Visibility: export
settime' : Timerfd->Bits32->Itimerspec->IO (EitherErrno ())
  Like `settime` but without storing the currently set `itimerspec`.

Totality: total
Visibility: export
gettime : Timerfd->Itimerspec->IO (EitherErrno ())
  Reads the currently set `itimerspec` of a `timerfd` and uses the given
pointer to place the data.

Totality: total
Visibility: export
readTimerfd : Timerfd->IO (EitherErrnoBits64)
  Reads data from a `timerfd`.

This will block until the next time the timer expires unless `TFD_NONBLOCK`
was set when creating the timer.

The value returned is the number of times the timer expired since
the last read.

Totality: total
Visibility: export
+

System.Linux.Timerfd

(source)

Reexports

importpublic Data.C.Ptr
importpublic System.Linux.Timerfd.Flags
importpublic System.Posix.File
importpublic System.Posix.Timer

Definitions

recordTimerfd : Type
  A file descriptor for signal handling.

This can be used for synchronous signal handling using
(blocking) `readSignalfd` directly, or for asynchronous signal handling
using `epoll`.

Totality: total
Visibility: export
Constructor: 
TFD : Bits32->Timerfd

Projection: 
.fd : Timerfd->Bits32

Hint: 
CastTimerfdFd
timerfd : ErrIOio=>ClockId->TimerfdFlags->ioTimerfd
  Opens a new `timerfd` file descriptor for observing the given clock.


Notes:
* A `signalfd` should be closed using `close` just like other file
descriptors.
* In general, use `readTimerfd` instead of the `read` functions
from `System.Posix.File` to read from a `timerfd`.

Totality: total
Visibility: export
settime : ErrIOio=>Timerfd->Bits32->Itimerspec->Itimerspec->io ()
  Sets the time of a `timerfd`.

The currently set time will be stored in `old`.
Use the `TFD_TIMER_ABSTIME` flag if the time should be interpreted as
an absolute wall clock time.

Totality: total
Visibility: export
settime' : ErrIOio=>Timerfd->Bits32->Itimerspec->io ()
  Like `settime` but without storing the currently set `itimerspec`.

Totality: total
Visibility: export
gettime : ErrIOio=>Timerfd->Itimerspec->io ()
  Reads the currently set `itimerspec` of a `timerfd` and uses the given
pointer to place the data.

Totality: total
Visibility: export
readTimerfd : ErrIOio=>Timerfd->ioBits64
  Reads data from a `timerfd`.

This will block until the next time the timer expires unless `TFD_NONBLOCK`
was set when creating the timer.

The value returned is the number of times the timer expired since
the last read.

Totality: total
Visibility: export
diff --git a/docs/linux/docs/docs/System.Linux.Timerfd.src.html b/docs/linux/docs/docs/System.Linux.Timerfd.src.html index 14b1b7a58..53184d845 100644 --- a/docs/linux/docs/docs/System.Linux.Timerfd.src.html +++ b/docs/linux/docs/docs/System.Linux.Timerfd.src.html @@ -172,7 +172,7 @@
51 | ||| * In general, use `readTimerfd` instead of the `read` functions
52 | |||   from `System.Posix.File` to read from a `timerfd`.
53 | export %inline
-
54 | timerfd : ClockId -> TimerfdFlags -> IO (Either Errno Timerfd)
+
54 | timerfd : ErrIO io => ClockId -> TimerfdFlags -> io Timerfd
55 | timerfd c (F f) = toVal (TFD . cast) $ prim__timerfd_create (clockCode c) f
56 |
57 | ||| Sets the time of a `timerfd`.
@@ -181,19 +181,19 @@
60 | ||| Use the `TFD_TIMER_ABSTIME` flag if the time should be interpreted as
61 | ||| an absolute wall clock time.
62 | export %inline
-
63 | settime : Timerfd -> Bits32 -> (new,old : Itimerspec) -> IO (Either Errno ())
+
63 | settime : ErrIO io => Timerfd -> Bits32 -> (new,old : Itimerspec) -> io ()
64 | settime t f new old =
65 |   toUnit $ prim__timerfd_settime t.fd f (unwrap new) (unwrap old)
66 |
67 | ||| Like `settime` but without storing the currently set `itimerspec`.
68 | export %inline
-
69 | settime' : Timerfd -> Bits32 -> (new : Itimerspec) -> IO (Either Errno ())
+
69 | settime' : ErrIO io => Timerfd -> Bits32 -> (new : Itimerspec) -> io ()
70 | settime' t f new = toUnit $ prim__timerfd_settime1 t.fd f (unwrap new)
71 |
72 | ||| Reads the currently set `itimerspec` of a `timerfd` and uses the given
73 | ||| pointer to place the data.
74 | export %inline
-
75 | gettime : Timerfd -> (old : Itimerspec) -> IO (Either Errno ())
+
75 | gettime : ErrIO io => Timerfd -> (old : Itimerspec) -> io ()
76 | gettime t old = toUnit $ prim__timerfd_gettime t.fd (unwrap old)
77 |
78 | ||| Reads data from a `timerfd`.
@@ -204,14 +204,11 @@
83 | ||| The value returned is the number of times the timer expired since
84 | ||| the last read.
85 | export %inline
-
86 | readTimerfd : Timerfd -> IO (Either Errno Bits64)
-
87 | readTimerfd t =
-
88 |   fromPrim $ \w =>
-
89 |     let MkIORes r w := prim__timerfd_read t.fd w
-
90 |      in case r < 0 of
-
91 |           True  => MkIORes (negErr r) w
-
92 |           False => MkIORes (Right $ cast r) w
-
93 |
+
86 | readTimerfd : ErrIO io => Timerfd -> io Bits64
+
87 | readTimerfd t = do
+
88 |   r <- primIO $ prim__timerfd_read t.fd
+
89 |   if r < 0 then error (fromNeg r) else pure (cast r)
+
90 |
diff --git a/docs/linux/docs/docs/System.Linux.User.Passwd.html b/docs/linux/docs/docs/System.Linux.User.Passwd.html index 6a36021a0..b26024b47 100644 --- a/docs/linux/docs/docs/System.Linux.User.Passwd.html +++ b/docs/linux/docs/docs/System.Linux.User.Passwd.html @@ -61,4 +61,4 @@ -

System.Linux.User.Passwd

(source)

Definitions

recordPasswdEntry : Type
  An entry in the `/etc/passwd` file.

Totality: total
Visibility: public export
Constructor: 
PE : String->String->UidT->GidT->String->String->String->PasswdEntry

Projections:
.comment : PasswdEntry->String
.gid : PasswdEntry->GidT
.homedir : PasswdEntry->String
.loginName : PasswdEntry->String
.password : PasswdEntry->String
.shell : PasswdEntry->String
.uid : PasswdEntry->UidT

Hints:
EqPasswdEntry
ShowPasswdEntry
.loginName : PasswdEntry->String
Totality: total
Visibility: public export
loginName : PasswdEntry->String
Totality: total
Visibility: public export
.password : PasswdEntry->String
Totality: total
Visibility: public export
password : PasswdEntry->String
Totality: total
Visibility: public export
.uid : PasswdEntry->UidT
Totality: total
Visibility: public export
uid : PasswdEntry->UidT
Totality: total
Visibility: public export
.gid : PasswdEntry->GidT
Totality: total
Visibility: public export
gid : PasswdEntry->GidT
Totality: total
Visibility: public export
.comment : PasswdEntry->String
Totality: total
Visibility: public export
comment : PasswdEntry->String
Totality: total
Visibility: public export
.homedir : PasswdEntry->String
Totality: total
Visibility: public export
homedir : PasswdEntry->String
Totality: total
Visibility: public export
.shell : PasswdEntry->String
Totality: total
Visibility: public export
shell : PasswdEntry->String
Totality: total
Visibility: public export
readEntry : ByteString->MaybePasswdEntry
Totality: total
Visibility: export
+

System.Linux.User.Passwd

(source)

Definitions

recordPasswdEntry : Type
  An entry in the `/etc/passwd` file.

Totality: total
Visibility: public export
Constructor: 
PE : String->String->UidT->GidT->String->String->String->PasswdEntry

Projections:
.comment : PasswdEntry->String
.gid : PasswdEntry->GidT
.homedir : PasswdEntry->String
.loginName : PasswdEntry->String
.password : PasswdEntry->String
.shell : PasswdEntry->String
.uid : PasswdEntry->UidT

Hints:
EqPasswdEntry
ShowPasswdEntry
.loginName : PasswdEntry->String
Totality: total
Visibility: public export
loginName : PasswdEntry->String
Totality: total
Visibility: public export
.password : PasswdEntry->String
Totality: total
Visibility: public export
password : PasswdEntry->String
Totality: total
Visibility: public export
.uid : PasswdEntry->UidT
Totality: total
Visibility: public export
uid : PasswdEntry->UidT
Totality: total
Visibility: public export
.gid : PasswdEntry->GidT
Totality: total
Visibility: public export
gid : PasswdEntry->GidT
Totality: total
Visibility: public export
.comment : PasswdEntry->String
Totality: total
Visibility: public export
comment : PasswdEntry->String
Totality: total
Visibility: public export
.homedir : PasswdEntry->String
Totality: total
Visibility: public export
homedir : PasswdEntry->String
Totality: total
Visibility: public export
.shell : PasswdEntry->String
Totality: total
Visibility: public export
shell : PasswdEntry->String
Totality: total
Visibility: public export
readEntry : ByteString->MaybePasswdEntry
Totality: total
Visibility: export
diff --git a/docs/linux/docs/index.html b/docs/linux/docs/index.html index 5b281827e..5ffd9b548 100644 --- a/docs/linux/docs/index.html +++ b/docs/linux/docs/index.html @@ -80,6 +80,24 @@
  • +
    + +
    + +
    +
    +
  • +
    + +
    + +
    +
    +
  • System.Linux.Signalfd diff --git a/docs/posix/docs/docs/System.Posix.Dir.html b/docs/posix/docs/docs/System.Posix.Dir.html index 0bbe4dc8f..58d40046e 100644 --- a/docs/posix/docs/docs/System.Posix.Dir.html +++ b/docs/posix/docs/docs/System.Posix.Dir.html @@ -61,4 +61,4 @@ -

    System.Posix.Dir

    (source)

    Reexports

    importpublic Data.Buffer.Core
    importpublic Data.ByteString
    importpublic Data.C.Integer
    importpublic System.Posix.Errno
    importpublic System.Posix.File

    Definitions

    recordDir : Type
    Totality: total
    Visibility: export
    Constructor: 
    MkDir : AnyPtr->Dir

    Projection: 
    .ptr : Dir->AnyPtr
    mkdir : String->Mode->IO (EitherErrno ())
      Creates a new directory.

    This fails if the directory exists already. It also fails, if the
    parent directory does not exist.

    Totality: total
    Visibility: export
    opendir : String->IO (EitherErrnoDir)
      Opens a directory.

    Totality: total
    Visibility: export
    fdopendir : FileDesca=>a->IO (EitherErrnoDir)
      Opens a directory from a file descriptor.

    Totality: total
    Visibility: export
    rewinddir : Dir->IO ()
      Closes a directory.

    Totality: total
    Visibility: export
    closedir : Dir->IO (EitherErrno ())
      Closes a directory.

    Totality: total
    Visibility: export
    readdir : Dir->IO (EitherErrno (MaybeByteString))
      Reads the next entry from a directory.

    Totality: total
    Visibility: export
    getcwd : IO (EitherErrnoByteString)
      Returns the current working directory.

    Totality: total
    Visibility: export
    chdir : String->IO (EitherErrno ())
      Changes the current working directory

    Totality: total
    Visibility: export
    chroot : String->IO (EitherErrno ())
      Changes the current working directory

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Dir

    (source)

    Reexports

    importpublic Data.Buffer.Core
    importpublic Data.ByteString
    importpublic Data.C.Integer
    importpublic System.Posix.Errno
    importpublic System.Posix.File

    Definitions

    recordDir : Type
    Totality: total
    Visibility: export
    Constructor: 
    MkDir : AnyPtr->Dir

    Projection: 
    .ptr : Dir->AnyPtr
    mkdir : ErrIOio=>String->Mode->io ()
      Creates a new directory.

    This fails if the directory exists already. It also fails, if the
    parent directory does not exist.

    Totality: total
    Visibility: export
    opendir : ErrIOio=>String->ioDir
      Opens a directory.

    Totality: total
    Visibility: export
    fdopendir : ErrIOio=>FileDesca=>a->ioDir
      Opens a directory from a file descriptor.

    Totality: total
    Visibility: export
    rewinddir : HasIOio=>Dir->io ()
      Closes a directory.

    Totality: total
    Visibility: export
    closedir : ErrIOio=>Dir->io ()
      Closes a directory.

    Totality: total
    Visibility: export
    readdir : ErrIOio=>Dir->io (MaybeByteString)
      Reads the next entry from a directory.

    Totality: total
    Visibility: export
    getcwd : ErrIOio=>ioByteString
      Returns the current working directory.

    Totality: total
    Visibility: export
    chdir : ErrIOio=>String->io ()
      Changes the current working directory

    Totality: total
    Visibility: export
    chroot : ErrIOio=>String->io ()
      Changes the current working directory

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Dir.src.html b/docs/posix/docs/docs/System.Posix.Dir.src.html index 326734248..c5c821e82 100644 --- a/docs/posix/docs/docs/System.Posix.Dir.src.html +++ b/docs/posix/docs/docs/System.Posix.Dir.src.html @@ -180,57 +180,56 @@
     59 | ||| This fails if the directory exists already. It also fails, if the
     60 | ||| parent directory does not exist.
     61 | export %inline
    -
     62 | mkdir : (pth : String) -> Mode -> IO (Either Errno ())
    +
     62 | mkdir : ErrIO io => (pth : String) -> Mode -> io ()
     63 | mkdir f (M m) = toUnit $ prim__mkdir f m
     65 | ||| Opens a directory.
     66 | export
    -
     67 | opendir : String -> IO (Either Errno Dir)
    +
     67 | opendir : ErrIO io => String -> io Dir
     68 | opendir s = do
    -
     69 |   p <- fromPrim $ prim__calloc_dir
    +
     69 |   p <- primIO $ prim__calloc_dir
     70 |   toRes (pure $ MkDir p) $ prim__opendir s p
     72 | ||| Opens a directory from a file descriptor.
     73 | export
    -
     74 | fdopendir : FileDesc a => a -> IO (Either Errno Dir)
    +
     74 | fdopendir : ErrIO io => FileDesc a => a -> io Dir
     75 | fdopendir fd = do
    -
     76 |   p <- fromPrim $ prim__calloc_dir
    +
     76 |   p <- primIO $ prim__calloc_dir
     77 |   toRes (pure $ MkDir p) $ prim__fdopendir (fileDesc fd) p
     79 | ||| Closes a directory.
     80 | export
    -
     81 | rewinddir : Dir -> IO ()
    -
     82 | rewinddir (MkDir p) = fromPrim $ prim__rewinddir p
    +
     81 | rewinddir : HasIO io => Dir -> io ()
    +
     82 | rewinddir (MkDir p) = primIO $ prim__rewinddir p
     84 | ||| Closes a directory.
     85 | export
    -
     86 | closedir : Dir -> IO (Either Errno ())
    +
     86 | closedir : ErrIO io => Dir -> io ()
     87 | closedir (MkDir p) = toUnit $ prim__closedir p
     89 | ||| Reads the next entry from a directory.
     90 | export
    -
     91 | readdir : Dir -> IO (Either Errno $ Maybe ByteString)
    +
     91 | readdir : ErrIO io => Dir -> io (Maybe ByteString)
     92 | readdir (MkDir p) =
     93 |   toBytes 256 (\b,_ => prim__readdir p b) >>= \case
    -
     94 |     Right (BS 0 _) => pure $ Right Nothing
    -
     95 |     Right bs       => pure $ Right (Just bs)
    -
     96 |     Left x         => pure (Left x)
    - -
     98 | ||| Returns the current working directory.
    -
     99 | export %inline
    -
    100 | getcwd : IO (Either Errno ByteString)
    -
    101 | getcwd = toBytes 4096 (prim__getcwd)
    - -
    103 | ||| Changes the current working directory
    -
    104 | export
    -
    105 | chdir : String -> IO (Either Errno ())
    -
    106 | chdir p = toUnit $ prim__chdir p
    - -
    108 | ||| Changes the current working directory
    -
    109 | export
    -
    110 | chroot : String -> IO (Either Errno ())
    -
    111 | chroot p = toUnit $ prim__chroot p
    - +
     94 |     BS 0 _ => pure Nothing
    +
     95 |     bs     => pure (Just bs)
    + +
     97 | ||| Returns the current working directory.
    +
     98 | export %inline
    +
     99 | getcwd : ErrIO io => io ByteString
    +
    100 | getcwd = toBytes 4096 (prim__getcwd)
    + +
    102 | ||| Changes the current working directory
    +
    103 | export
    +
    104 | chdir : ErrIO io => String -> io ()
    +
    105 | chdir p = toUnit $ prim__chdir p
    + +
    107 | ||| Changes the current working directory
    +
    108 | export
    +
    109 | chroot : ErrIO io => String -> io ()
    +
    110 | chroot p = toUnit $ prim__chroot p
    + diff --git a/docs/posix/docs/docs/System.Posix.Errno.Type.html b/docs/posix/docs/docs/System.Posix.Errno.Type.html index 4499bd5f4..9ccca2c03 100644 --- a/docs/posix/docs/docs/System.Posix.Errno.Type.html +++ b/docs/posix/docs/docs/System.Posix.Errno.Type.html @@ -61,4 +61,4 @@ -

    System.Posix.Errno.Type

    (source)

    Definitions

    dataErrno : Type
    Totality: total
    Visibility: public export
    Constructors:
    EPERM : Errno
    ENOENT : Errno
    ESRCH : Errno
    EINTR : Errno
    EIO : Errno
    ENXIO : Errno
    E2BIG : Errno
    ENOEXEC : Errno
    EBADF : Errno
    ECHILD : Errno
    EAGAIN : Errno
    ENOMEM : Errno
    EACCES : Errno
    EFAULT : Errno
    ENOTBLK : Errno
    EBUSY : Errno
    EEXIST : Errno
    EXDEV : Errno
    ENODEV : Errno
    ENOTDIR : Errno
    EISDIR : Errno
    EINVAL : Errno
    ENFILE : Errno
    EMFILE : Errno
    ENOTTY : Errno
    ETXTBSY : Errno
    EFBIG : Errno
    ENOSPC : Errno
    ESPIPE : Errno
    EROFS : Errno
    EPIPE : Errno
    EDOM : Errno
    ERANGE : Errno
    EDEADLK : Errno
    ENAMETOOLONG : Errno
    ENOLCK : Errno
    ENOSYS : Errno
    ENOTEMPTY : Errno
    ELOOP : Errno
    ENOMSG : Errno
    EIDRM : Errno
    ECHRNG : Errno
    EL2NSYNC : Errno
    EL3HLT : Errno
    EL3RST : Errno
    ELNRNG : Errno
    EUNATCH : Errno
    ENOCSI : Errno
    EL2HLT : Errno
    EBADE : Errno
    EBADR : Errno
    EXFULL : Errno
    ENOANO : Errno
    EBADRQC : Errno
    EBADSLT : Errno
    EDEADLOCK : Errno
    EBFONT : Errno
    ENOSTR : Errno
    ENODATA : Errno
    ETIME : Errno
    ENOSR : Errno
    ENONET : Errno
    ENOPKG : Errno
    EREMOTE : Errno
    EADV : Errno
    ESRMNT : Errno
    ECOMM : Errno
    EPROTO : Errno
    EMULTIHOP : Errno
    EDOTDOT : Errno
    EBADMSG : Errno
    EOVERFLOW : Errno
    ENOTUNIQ : Errno
    EBADFD : Errno
    EREMCHG : Errno
    ELIBACC : Errno
    ELIBBAD : Errno
    ELIBSCN : Errno
    ELIBMAX : Errno
    ELIBEXEC : Errno
    EILSEQ : Errno
    ERESTART : Errno
    ESTRPIPE : Errno
    EUSERS : Errno
    ENOTSOCK : Errno
    EDESTADDRREQ : Errno
    EMSGSIZE : Errno
    EPROTOTYPE : Errno
    ENOPROTOOPT : Errno
    EPROTONOSUPPORT : Errno
    ESOCKTNOSUPPORT : Errno
    EOPNOTSUPP : Errno
    EPFNOSUPPORT : Errno
    EAFNOSUPPORT : Errno
    EADDRINUSE : Errno
    EADDRNOTAVAIL : Errno
    ENETDOWN : Errno
    ENETUNREACH : Errno
    ENETRESET : Errno
    ECONNABORTED : Errno
    ECONNRESET : Errno
    ENOBUFS : Errno
    EISCONN : Errno
    ENOTCONN : Errno
    ESHUTDOWN : Errno
    ETOOMANYREFS : Errno
    ETIMEDOUT : Errno
    ECONNREFUSED : Errno
    EHOSTDOWN : Errno
    EHOSTUNREACH : Errno
    EALREADY : Errno
    EINPROGRESS : Errno
    ESTALE : Errno
    EUCLEAN : Errno
    ENOTNAM : Errno
    ENAVAIL : Errno
    EISNAM : Errno
    EREMOTEIO : Errno
    EDQUOT : Errno
    ENOMEDIUM : Errno
    EMEDIUMTYPE : Errno
    ECANCELED : Errno
    ENOKEY : Errno
    EKEYEXPIRED : Errno
    EKEYREVOKED : Errno
    EKEYREJECTED : Errno
    EOWNERDEAD : Errno
    ENOTRECOVERABLE : Errno
    ERFKILL : Errno
    EHWPOISON : Errno
    EOTHER : Errno

    Hints:
    EqErrno
    FiniteErrno
    InterpolationErrno
    OrdErrno
    ShowErrno
    errorCode : Errno->Bits32
    Totality: total
    Visibility: public export
    errorText : Errno->String
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Errno.Type

    (source)

    Definitions

    recordErrno : Type
    Totality: total
    Visibility: public export
    Constructor: 
    EN : Bits32->Errno

    Projection: 
    .errno : Errno->Bits32

    Hints:
    EqErrno
    InterpolationErrno
    OrdErrno
    ShowErrno
    .errno : Errno->Bits32
    Totality: total
    Visibility: public export
    errno : Errno->Bits32
    Totality: total
    Visibility: public export
    EPERM : Errno
    Totality: total
    Visibility: public export
    ENOENT : Errno
    Totality: total
    Visibility: public export
    ESRCH : Errno
    Totality: total
    Visibility: public export
    EINTR : Errno
    Totality: total
    Visibility: public export
    EIO : Errno
    Totality: total
    Visibility: public export
    ENXIO : Errno
    Totality: total
    Visibility: public export
    E2BIG : Errno
    Totality: total
    Visibility: public export
    ENOEXEC : Errno
    Totality: total
    Visibility: public export
    EBADF : Errno
    Totality: total
    Visibility: public export
    ECHILD : Errno
    Totality: total
    Visibility: public export
    EAGAIN : Errno
    Totality: total
    Visibility: public export
    ENOMEM : Errno
    Totality: total
    Visibility: public export
    EACCES : Errno
    Totality: total
    Visibility: public export
    EFAULT : Errno
    Totality: total
    Visibility: public export
    ENOTBLK : Errno
    Totality: total
    Visibility: public export
    EBUSY : Errno
    Totality: total
    Visibility: public export
    EEXIST : Errno
    Totality: total
    Visibility: public export
    EXDEV : Errno
    Totality: total
    Visibility: public export
    ENODEV : Errno
    Totality: total
    Visibility: public export
    ENOTDIR : Errno
    Totality: total
    Visibility: public export
    EISDIR : Errno
    Totality: total
    Visibility: public export
    EINVAL : Errno
    Totality: total
    Visibility: public export
    ENFILE : Errno
    Totality: total
    Visibility: public export
    EMFILE : Errno
    Totality: total
    Visibility: public export
    ENOTTY : Errno
    Totality: total
    Visibility: public export
    ETXTBSY : Errno
    Totality: total
    Visibility: public export
    EFBIG : Errno
    Totality: total
    Visibility: public export
    ENOSPC : Errno
    Totality: total
    Visibility: public export
    ESPIPE : Errno
    Totality: total
    Visibility: public export
    EROFS : Errno
    Totality: total
    Visibility: public export
    Totality: total
    Visibility: public export
    EPIPE : Errno
    Totality: total
    Visibility: public export
    EDOM : Errno
    Totality: total
    Visibility: public export
    ERANGE : Errno
    Totality: total
    Visibility: public export
    EDEADLK : Errno
    Totality: total
    Visibility: public export
    ENAMETOOLONG : Errno
    Totality: total
    Visibility: public export
    ENOLCK : Errno
    Totality: total
    Visibility: public export
    ENOSYS : Errno
    Totality: total
    Visibility: public export
    ENOTEMPTY : Errno
    Totality: total
    Visibility: public export
    ELOOP : Errno
    Totality: total
    Visibility: public export
    ENOMSG : Errno
    Totality: total
    Visibility: public export
    EIDRM : Errno
    Totality: total
    Visibility: public export
    ECHRNG : Errno
    Totality: total
    Visibility: public export
    EL2NSYNC : Errno
    Totality: total
    Visibility: public export
    EL3HLT : Errno
    Totality: total
    Visibility: public export
    EL3RST : Errno
    Totality: total
    Visibility: public export
    ELNRNG : Errno
    Totality: total
    Visibility: public export
    EUNATCH : Errno
    Totality: total
    Visibility: public export
    ENOCSI : Errno
    Totality: total
    Visibility: public export
    EL2HLT : Errno
    Totality: total
    Visibility: public export
    EBADE : Errno
    Totality: total
    Visibility: public export
    EBADR : Errno
    Totality: total
    Visibility: public export
    EXFULL : Errno
    Totality: total
    Visibility: public export
    ENOANO : Errno
    Totality: total
    Visibility: public export
    EBADRQC : Errno
    Totality: total
    Visibility: public export
    EBADSLT : Errno
    Totality: total
    Visibility: public export
    EBFONT : Errno
    Totality: total
    Visibility: public export
    ENOSTR : Errno
    Totality: total
    Visibility: public export
    ENODATA : Errno
    Totality: total
    Visibility: public export
    ETIME : Errno
    Totality: total
    Visibility: public export
    ENOSR : Errno
    Totality: total
    Visibility: public export
    ENONET : Errno
    Totality: total
    Visibility: public export
    ENOPKG : Errno
    Totality: total
    Visibility: public export
    EREMOTE : Errno
    Totality: total
    Visibility: public export
    Totality: total
    Visibility: public export
    EADV : Errno
    Totality: total
    Visibility: public export
    ESRMNT : Errno
    Totality: total
    Visibility: public export
    ECOMM : Errno
    Totality: total
    Visibility: public export
    EPROTO : Errno
    Totality: total
    Visibility: public export
    EMULTIHOP : Errno
    Totality: total
    Visibility: public export
    EDOTDOT : Errno
    Totality: total
    Visibility: public export
    EBADMSG : Errno
    Totality: total
    Visibility: public export
    EOVERFLOW : Errno
    Totality: total
    Visibility: public export
    ENOTUNIQ : Errno
    Totality: total
    Visibility: public export
    EBADFD : Errno
    Totality: total
    Visibility: public export
    EREMCHG : Errno
    Totality: total
    Visibility: public export
    ELIBACC : Errno
    Totality: total
    Visibility: public export
    ELIBBAD : Errno
    Totality: total
    Visibility: public export
    ELIBSCN : Errno
    Totality: total
    Visibility: public export
    ELIBMAX : Errno
    Totality: total
    Visibility: public export
    ELIBEXEC : Errno
    Totality: total
    Visibility: public export
    EILSEQ : Errno
    Totality: total
    Visibility: public export
    ERESTART : Errno
    Totality: total
    Visibility: public export
    ESTRPIPE : Errno
    Totality: total
    Visibility: public export
    EUSERS : Errno
    Totality: total
    Visibility: public export
    ENOTSOCK : Errno
    Totality: total
    Visibility: public export
    EDESTADDRREQ : Errno
    Totality: total
    Visibility: public export
    EMSGSIZE : Errno
    Totality: total
    Visibility: public export
    EPROTOTYPE : Errno
    Totality: total
    Visibility: public export
    ENOPROTOOPT : Errno
    Totality: total
    Visibility: public export
    EPROTONOSUPPORT : Errno
    Totality: total
    Visibility: public export
    ESOCKTNOSUPPORT : Errno
    Totality: total
    Visibility: public export
    EOPNOTSUPP : Errno
    Totality: total
    Visibility: public export
    EPFNOSUPPORT : Errno
    Totality: total
    Visibility: public export
    EAFNOSUPPORT : Errno
    Totality: total
    Visibility: public export
    EADDRINUSE : Errno
    Totality: total
    Visibility: public export
    EADDRNOTAVAIL : Errno
    Totality: total
    Visibility: public export
    ENETDOWN : Errno
    Totality: total
    Visibility: public export
    ENETUNREACH : Errno
    Totality: total
    Visibility: public export
    ENETRESET : Errno
    Totality: total
    Visibility: public export
    ECONNABORTED : Errno
    Totality: total
    Visibility: public export
    ECONNRESET : Errno
    Totality: total
    Visibility: public export
    ENOBUFS : Errno
    Totality: total
    Visibility: public export
    EISCONN : Errno
    Totality: total
    Visibility: public export
    ENOTCONN : Errno
    Totality: total
    Visibility: public export
    ESHUTDOWN : Errno
    Totality: total
    Visibility: public export
    ETOOMANYREFS : Errno
    Totality: total
    Visibility: public export
    ETIMEDOUT : Errno
    Totality: total
    Visibility: public export
    ECONNREFUSED : Errno
    Totality: total
    Visibility: public export
    EHOSTDOWN : Errno
    Totality: total
    Visibility: public export
    EHOSTUNREACH : Errno
    Totality: total
    Visibility: public export
    EALREADY : Errno
    Totality: total
    Visibility: public export
    EINPROGRESS : Errno
    Totality: total
    Visibility: public export
    ESTALE : Errno
    Totality: total
    Visibility: public export
    EUCLEAN : Errno
    Totality: total
    Visibility: public export
    ENOTNAM : Errno
    Totality: total
    Visibility: public export
    ENAVAIL : Errno
    Totality: total
    Visibility: public export
    EISNAM : Errno
    Totality: total
    Visibility: public export
    EREMOTEIO : Errno
    Totality: total
    Visibility: public export
    EDQUOT : Errno
    Totality: total
    Visibility: public export
    ENOMEDIUM : Errno
    Totality: total
    Visibility: public export
    EMEDIUMTYPE : Errno
    Totality: total
    Visibility: public export
    ECANCELED : Errno
    Totality: total
    Visibility: public export
    ENOKEY : Errno
    Totality: total
    Visibility: public export
    EKEYEXPIRED : Errno
    Totality: total
    Visibility: public export
    EKEYREVOKED : Errno
    Totality: total
    Visibility: public export
    EKEYREJECTED : Errno
    Totality: total
    Visibility: public export
    EOWNERDEAD : Errno
    Totality: total
    Visibility: public export
    ENOTRECOVERABLE : Errno
    Totality: total
    Visibility: public export
    ERFKILL : Errno
    Totality: total
    Visibility: public export
    EHWPOISON : Errno
    Totality: total
    Visibility: public export
    errorText : Errno->String
    Totality: total
    Visibility: export
    errorName : Errno->String
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Errno.Type.src.html b/docs/posix/docs/docs/System.Posix.Errno.Type.src.html index ec066cbbc..625bc899d 100644 --- a/docs/posix/docs/docs/System.Posix.Errno.Type.src.html +++ b/docs/posix/docs/docs/System.Posix.Errno.Type.src.html @@ -135,415 +135,807 @@
     14 | %language ElabReflection
     16 | public export
    -
     17 | data Errno : Type where
    -
     18 |   EPERM : Errno
    -
     19 |   ENOENT : Errno
    -
     20 |   ESRCH : Errno
    -
     21 |   EINTR : Errno
    -
     22 |   EIO : Errno
    -
     23 |   ENXIO : Errno
    -
     24 |   E2BIG : Errno
    -
     25 |   ENOEXEC : Errno
    -
     26 |   EBADF : Errno
    -
     27 |   ECHILD : Errno
    -
     28 |   EAGAIN : Errno
    -
     29 |   ENOMEM : Errno
    -
     30 |   EACCES : Errno
    -
     31 |   EFAULT : Errno
    -
     32 |   ENOTBLK : Errno
    -
     33 |   EBUSY : Errno
    -
     34 |   EEXIST : Errno
    -
     35 |   EXDEV : Errno
    -
     36 |   ENODEV : Errno
    -
     37 |   ENOTDIR : Errno
    -
     38 |   EISDIR : Errno
    -
     39 |   EINVAL : Errno
    -
     40 |   ENFILE : Errno
    -
     41 |   EMFILE : Errno
    -
     42 |   ENOTTY : Errno
    -
     43 |   ETXTBSY : Errno
    -
     44 |   EFBIG : Errno
    -
     45 |   ENOSPC : Errno
    -
     46 |   ESPIPE : Errno
    -
     47 |   EROFS : Errno
    -
     48 |   EMLINK : Errno
    -
     49 |   EPIPE : Errno
    -
     50 |   EDOM : Errno
    -
     51 |   ERANGE : Errno
    -
     52 |   EDEADLK : Errno
    -
     53 |   ENAMETOOLONG : Errno
    -
     54 |   ENOLCK : Errno
    -
     55 |   ENOSYS : Errno
    -
     56 |   ENOTEMPTY : Errno
    -
     57 |   ELOOP : Errno
    -
     58 |   ENOMSG : Errno
    -
     59 |   EIDRM : Errno
    -
     60 |   ECHRNG : Errno
    -
     61 |   EL2NSYNC : Errno
    -
     62 |   EL3HLT : Errno
    -
     63 |   EL3RST : Errno
    -
     64 |   ELNRNG : Errno
    -
     65 |   EUNATCH : Errno
    -
     66 |   ENOCSI : Errno
    -
     67 |   EL2HLT : Errno
    -
     68 |   EBADE : Errno
    -
     69 |   EBADR : Errno
    -
     70 |   EXFULL : Errno
    -
     71 |   ENOANO : Errno
    -
     72 |   EBADRQC : Errno
    -
     73 |   EBADSLT : Errno
    -
     74 |   EDEADLOCK : Errno
    -
     75 |   EBFONT : Errno
    -
     76 |   ENOSTR : Errno
    -
     77 |   ENODATA : Errno
    -
     78 |   ETIME : Errno
    -
     79 |   ENOSR : Errno
    -
     80 |   ENONET : Errno
    -
     81 |   ENOPKG : Errno
    -
     82 |   EREMOTE : Errno
    -
     83 |   ENOLINK : Errno
    -
     84 |   EADV : Errno
    -
     85 |   ESRMNT : Errno
    -
     86 |   ECOMM : Errno
    -
     87 |   EPROTO : Errno
    -
     88 |   EMULTIHOP : Errno
    -
     89 |   EDOTDOT : Errno
    -
     90 |   EBADMSG : Errno
    -
     91 |   EOVERFLOW : Errno
    -
     92 |   ENOTUNIQ : Errno
    -
     93 |   EBADFD : Errno
    -
     94 |   EREMCHG : Errno
    -
     95 |   ELIBACC : Errno
    -
     96 |   ELIBBAD : Errno
    -
     97 |   ELIBSCN : Errno
    -
     98 |   ELIBMAX : Errno
    -
     99 |   ELIBEXEC : Errno
    -
    100 |   EILSEQ : Errno
    -
    101 |   ERESTART : Errno
    -
    102 |   ESTRPIPE : Errno
    -
    103 |   EUSERS : Errno
    -
    104 |   ENOTSOCK : Errno
    -
    105 |   EDESTADDRREQ : Errno
    -
    106 |   EMSGSIZE : Errno
    -
    107 |   EPROTOTYPE : Errno
    -
    108 |   ENOPROTOOPT : Errno
    -
    109 |   EPROTONOSUPPORT : Errno
    -
    110 |   ESOCKTNOSUPPORT : Errno
    -
    111 |   EOPNOTSUPP : Errno
    -
    112 |   EPFNOSUPPORT : Errno
    -
    113 |   EAFNOSUPPORT : Errno
    -
    114 |   EADDRINUSE : Errno
    -
    115 |   EADDRNOTAVAIL : Errno
    -
    116 |   ENETDOWN : Errno
    -
    117 |   ENETUNREACH : Errno
    -
    118 |   ENETRESET : Errno
    -
    119 |   ECONNABORTED : Errno
    -
    120 |   ECONNRESET : Errno
    -
    121 |   ENOBUFS : Errno
    -
    122 |   EISCONN : Errno
    -
    123 |   ENOTCONN : Errno
    -
    124 |   ESHUTDOWN : Errno
    -
    125 |   ETOOMANYREFS : Errno
    -
    126 |   ETIMEDOUT : Errno
    -
    127 |   ECONNREFUSED : Errno
    -
    128 |   EHOSTDOWN : Errno
    -
    129 |   EHOSTUNREACH : Errno
    -
    130 |   EALREADY : Errno
    -
    131 |   EINPROGRESS : Errno
    -
    132 |   ESTALE : Errno
    -
    133 |   EUCLEAN : Errno
    -
    134 |   ENOTNAM : Errno
    -
    135 |   ENAVAIL : Errno
    -
    136 |   EISNAM : Errno
    -
    137 |   EREMOTEIO : Errno
    -
    138 |   EDQUOT : Errno
    -
    139 |   ENOMEDIUM : Errno
    -
    140 |   EMEDIUMTYPE : Errno
    -
    141 |   ECANCELED : Errno
    -
    142 |   ENOKEY : Errno
    -
    143 |   EKEYEXPIRED : Errno
    -
    144 |   EKEYREVOKED : Errno
    -
    145 |   EKEYREJECTED : Errno
    -
    146 |   EOWNERDEAD : Errno
    -
    147 |   ENOTRECOVERABLE : Errno
    -
    148 |   ERFKILL : Errno
    -
    149 |   EHWPOISON : Errno
    -
    150 |   EOTHER : Errno
    +
     17 | record Errno where
    +
     18 |   constructor EN
    +
     19 |   errno : Bits32
    + +
     21 | %runElab derive "Errno" [Show,Eq,Ord,FromInteger]
    + + +
     24 | public export %inline
    +
     25 | EPERM : Errno
    +
     26 | EPERM = 1
    + +
     28 | public export %inline
    +
     29 | ENOENT : Errno
    +
     30 | ENOENT = 2
    + +
     32 | public export %inline
    +
     33 | ESRCH : Errno
    +
     34 | ESRCH = 3
    + +
     36 | public export %inline
    +
     37 | EINTR : Errno
    +
     38 | EINTR = 4
    + +
     40 | public export %inline
    +
     41 | EIO : Errno
    +
     42 | EIO = 5
    + +
     44 | public export %inline
    +
     45 | ENXIO : Errno
    +
     46 | ENXIO = 6
    + +
     48 | public export %inline
    +
     49 | E2BIG : Errno
    +
     50 | E2BIG = 7
    + +
     52 | public export %inline
    +
     53 | ENOEXEC : Errno
    +
     54 | ENOEXEC = 8
    + +
     56 | public export %inline
    +
     57 | EBADF : Errno
    +
     58 | EBADF = 9
    + +
     60 | public export %inline
    +
     61 | ECHILD : Errno
    +
     62 | ECHILD = 10
    + +
     64 | public export %inline
    +
     65 | EAGAIN : Errno
    +
     66 | EAGAIN = 11
    + +
     68 | public export %inline
    +
     69 | ENOMEM : Errno
    +
     70 | ENOMEM = 12
    + +
     72 | public export %inline
    +
     73 | EACCES : Errno
    +
     74 | EACCES = 13
    + +
     76 | public export %inline
    +
     77 | EFAULT : Errno
    +
     78 | EFAULT = 14
    + +
     80 | public export %inline
    +
     81 | ENOTBLK : Errno
    +
     82 | ENOTBLK = 15
    + +
     84 | public export %inline
    +
     85 | EBUSY : Errno
    +
     86 | EBUSY = 16
    + +
     88 | public export %inline
    +
     89 | EEXIST : Errno
    +
     90 | EEXIST = 17
    + +
     92 | public export %inline
    +
     93 | EXDEV : Errno
    +
     94 | EXDEV = 18
    + +
     96 | public export %inline
    +
     97 | ENODEV : Errno
    +
     98 | ENODEV = 19
    + +
    100 | public export %inline
    +
    101 | ENOTDIR : Errno
    +
    102 | ENOTDIR = 20
    + +
    104 | public export %inline
    +
    105 | EISDIR : Errno
    +
    106 | EISDIR = 21
    + +
    108 | public export %inline
    +
    109 | EINVAL : Errno
    +
    110 | EINVAL = 22
    + +
    112 | public export %inline
    +
    113 | ENFILE : Errno
    +
    114 | ENFILE = 23
    + +
    116 | public export %inline
    +
    117 | EMFILE : Errno
    +
    118 | EMFILE = 24
    + +
    120 | public export %inline
    +
    121 | ENOTTY : Errno
    +
    122 | ENOTTY = 25
    + +
    124 | public export %inline
    +
    125 | ETXTBSY : Errno
    +
    126 | ETXTBSY = 26
    + +
    128 | public export %inline
    +
    129 | EFBIG : Errno
    +
    130 | EFBIG = 27
    + +
    132 | public export %inline
    +
    133 | ENOSPC : Errno
    +
    134 | ENOSPC = 28
    + +
    136 | public export %inline
    +
    137 | ESPIPE : Errno
    +
    138 | ESPIPE = 29
    + +
    140 | public export %inline
    +
    141 | EROFS : Errno
    +
    142 | EROFS = 30
    + +
    144 | public export %inline
    +
    145 | EMLINK : Errno
    +
    146 | EMLINK = 31
    + +
    148 | public export %inline
    +
    149 | EPIPE : Errno
    +
    150 | EPIPE = 32
    -
    152 | %runElab derive "Errno" [Show,Eq,Ord,Finite]
    - -
    154 | public export
    -
    155 | errorCode : Errno -> Bits32
    -
    156 | errorCode EPERM = 1
    -
    157 | errorCode ENOENT = 2
    -
    158 | errorCode ESRCH = 3
    -
    159 | errorCode EINTR = 4
    -
    160 | errorCode EIO = 5
    -
    161 | errorCode ENXIO = 6
    -
    162 | errorCode E2BIG = 7
    -
    163 | errorCode ENOEXEC = 8
    -
    164 | errorCode EBADF = 9
    -
    165 | errorCode ECHILD = 10
    -
    166 | errorCode EAGAIN = 11
    -
    167 | errorCode ENOMEM = 12
    -
    168 | errorCode EACCES = 13
    -
    169 | errorCode EFAULT = 14
    -
    170 | errorCode ENOTBLK = 15
    -
    171 | errorCode EBUSY = 16
    -
    172 | errorCode EEXIST = 17
    -
    173 | errorCode EXDEV = 18
    -
    174 | errorCode ENODEV = 19
    -
    175 | errorCode ENOTDIR = 20
    -
    176 | errorCode EISDIR = 21
    -
    177 | errorCode EINVAL = 22
    -
    178 | errorCode ENFILE = 23
    -
    179 | errorCode EMFILE = 24
    -
    180 | errorCode ENOTTY = 25
    -
    181 | errorCode ETXTBSY = 26
    -
    182 | errorCode EFBIG = 27
    -
    183 | errorCode ENOSPC = 28
    -
    184 | errorCode ESPIPE = 29
    -
    185 | errorCode EROFS = 30
    -
    186 | errorCode EMLINK = 31
    -
    187 | errorCode EPIPE = 32
    -
    188 | errorCode EDOM = 33
    -
    189 | errorCode ERANGE = 34
    -
    190 | errorCode EDEADLK = 35
    -
    191 | errorCode ENAMETOOLONG = 36
    -
    192 | errorCode ENOLCK = 37
    -
    193 | errorCode ENOSYS = 38
    -
    194 | errorCode ENOTEMPTY = 39
    -
    195 | errorCode ELOOP = 40
    -
    196 | errorCode ENOMSG = 42
    -
    197 | errorCode EIDRM = 43
    -
    198 | errorCode ECHRNG = 44
    -
    199 | errorCode EL2NSYNC = 45
    -
    200 | errorCode EL3HLT = 46
    -
    201 | errorCode EL3RST = 47
    -
    202 | errorCode ELNRNG = 48
    -
    203 | errorCode EUNATCH = 49
    -
    204 | errorCode ENOCSI = 50
    -
    205 | errorCode EL2HLT = 51
    -
    206 | errorCode EBADE = 52
    -
    207 | errorCode EBADR = 53
    -
    208 | errorCode EXFULL = 54
    -
    209 | errorCode ENOANO = 55
    -
    210 | errorCode EBADRQC = 56
    -
    211 | errorCode EBADSLT = 57
    -
    212 | errorCode EDEADLOCK = 35
    -
    213 | errorCode EBFONT = 59
    -
    214 | errorCode ENOSTR = 60
    -
    215 | errorCode ENODATA = 61
    -
    216 | errorCode ETIME = 62
    -
    217 | errorCode ENOSR = 63
    -
    218 | errorCode ENONET = 64
    -
    219 | errorCode ENOPKG = 65
    -
    220 | errorCode EREMOTE = 66
    -
    221 | errorCode ENOLINK = 67
    -
    222 | errorCode EADV = 68
    -
    223 | errorCode ESRMNT = 69
    -
    224 | errorCode ECOMM = 70
    -
    225 | errorCode EPROTO = 71
    -
    226 | errorCode EMULTIHOP = 72
    -
    227 | errorCode EDOTDOT = 73
    -
    228 | errorCode EBADMSG = 74
    -
    229 | errorCode EOVERFLOW = 75
    -
    230 | errorCode ENOTUNIQ = 76
    -
    231 | errorCode EBADFD = 77
    -
    232 | errorCode EREMCHG = 78
    -
    233 | errorCode ELIBACC = 79
    -
    234 | errorCode ELIBBAD = 80
    -
    235 | errorCode ELIBSCN = 81
    -
    236 | errorCode ELIBMAX = 82
    -
    237 | errorCode ELIBEXEC = 83
    -
    238 | errorCode EILSEQ = 84
    -
    239 | errorCode ERESTART = 85
    -
    240 | errorCode ESTRPIPE = 86
    -
    241 | errorCode EUSERS = 87
    -
    242 | errorCode ENOTSOCK = 88
    -
    243 | errorCode EDESTADDRREQ = 89
    -
    244 | errorCode EMSGSIZE = 90
    -
    245 | errorCode EPROTOTYPE = 91
    -
    246 | errorCode ENOPROTOOPT = 92
    -
    247 | errorCode EPROTONOSUPPORT = 93
    -
    248 | errorCode ESOCKTNOSUPPORT = 94
    -
    249 | errorCode EOPNOTSUPP = 95
    -
    250 | errorCode EPFNOSUPPORT = 96
    -
    251 | errorCode EAFNOSUPPORT = 97
    -
    252 | errorCode EADDRINUSE = 98
    -
    253 | errorCode EADDRNOTAVAIL = 99
    -
    254 | errorCode ENETDOWN = 100
    -
    255 | errorCode ENETUNREACH = 101
    -
    256 | errorCode ENETRESET = 102
    -
    257 | errorCode ECONNABORTED = 103
    -
    258 | errorCode ECONNRESET = 104
    -
    259 | errorCode ENOBUFS = 105
    -
    260 | errorCode EISCONN = 106
    -
    261 | errorCode ENOTCONN = 107
    -
    262 | errorCode ESHUTDOWN = 108
    -
    263 | errorCode ETOOMANYREFS = 109
    -
    264 | errorCode ETIMEDOUT = 110
    -
    265 | errorCode ECONNREFUSED = 111
    -
    266 | errorCode EHOSTDOWN = 112
    -
    267 | errorCode EHOSTUNREACH = 113
    -
    268 | errorCode EALREADY = 114
    -
    269 | errorCode EINPROGRESS = 115
    -
    270 | errorCode ESTALE = 116
    -
    271 | errorCode EUCLEAN = 117
    -
    272 | errorCode ENOTNAM = 118
    -
    273 | errorCode ENAVAIL = 119
    -
    274 | errorCode EISNAM = 120
    -
    275 | errorCode EREMOTEIO = 121
    -
    276 | errorCode EDQUOT = 122
    -
    277 | errorCode ENOMEDIUM = 123
    -
    278 | errorCode EMEDIUMTYPE = 124
    -
    279 | errorCode ECANCELED = 125
    -
    280 | errorCode ENOKEY = 126
    -
    281 | errorCode EKEYEXPIRED = 127
    -
    282 | errorCode EKEYREVOKED = 128
    -
    283 | errorCode EKEYREJECTED = 129
    -
    284 | errorCode EOWNERDEAD = 130
    -
    285 | errorCode ENOTRECOVERABLE = 131
    -
    286 | errorCode ERFKILL = 132
    -
    287 | errorCode EHWPOISON = 133
    -
    288 | errorCode EOTHER = 0
    - -
    290 | export
    -
    291 | errorText : Errno -> String
    -
    292 | errorText EPERM = "Operation not permitted"
    -
    293 | errorText ENOENT = "No such file or directory"
    -
    294 | errorText ESRCH = "No such process"
    -
    295 | errorText EINTR = "Interrupted system call"
    -
    296 | errorText EIO = "Input/output error"
    -
    297 | errorText ENXIO = "No such device or address"
    -
    298 | errorText E2BIG = "Argument list too long"
    -
    299 | errorText ENOEXEC = "Exec format error"
    -
    300 | errorText EBADF = "Bad file descriptor"
    -
    301 | errorText ECHILD = "No child processes"
    -
    302 | errorText EAGAIN = "Resource temporarily unavailable"
    -
    303 | errorText ENOMEM = "Cannot allocate memory"
    -
    304 | errorText EACCES = "Permission denied"
    -
    305 | errorText EFAULT = "Bad address"
    -
    306 | errorText ENOTBLK = "Block device required"
    -
    307 | errorText EBUSY = "Device or resource busy"
    -
    308 | errorText EEXIST = "File exists"
    -
    309 | errorText EXDEV = "Invalid cross-device link"
    -
    310 | errorText ENODEV = "No such device"
    -
    311 | errorText ENOTDIR = "Not a directory"
    -
    312 | errorText EISDIR = "Is a directory"
    -
    313 | errorText EINVAL = "Invalid argument"
    -
    314 | errorText ENFILE = "Too many open files in system"
    -
    315 | errorText EMFILE = "Too many open files"
    -
    316 | errorText ENOTTY = "Inappropriate ioctl for device"
    -
    317 | errorText ETXTBSY = "Text file busy"
    -
    318 | errorText EFBIG = "File too large"
    -
    319 | errorText ENOSPC = "No space left on device"
    -
    320 | errorText ESPIPE = "Illegal seek"
    -
    321 | errorText EROFS = "Read-only file system"
    -
    322 | errorText EMLINK = "Too many links"
    -
    323 | errorText EPIPE = "Broken pipe"
    -
    324 | errorText EDOM = "Numerical argument out of domain"
    -
    325 | errorText ERANGE = "Numerical result out of range"
    -
    326 | errorText EDEADLK = "Resource deadlock avoided"
    -
    327 | errorText ENAMETOOLONG = "File name too long"
    -
    328 | errorText ENOLCK = "No locks available"
    -
    329 | errorText ENOSYS = "Function not implemented"
    -
    330 | errorText ENOTEMPTY = "Directory not empty"
    -
    331 | errorText ELOOP = "Too many levels of symbolic links"
    -
    332 | errorText ENOMSG = "No message of desired type"
    -
    333 | errorText EIDRM = "Identifier removed"
    -
    334 | errorText ECHRNG = "Channel number out of range"
    -
    335 | errorText EL2NSYNC = "Level 2 not synchronized"
    -
    336 | errorText EL3HLT = "Level 3 halted"
    -
    337 | errorText EL3RST = "Level 3 reset"
    -
    338 | errorText ELNRNG = "Link number out of range"
    -
    339 | errorText EUNATCH = "Protocol driver not attached"
    -
    340 | errorText ENOCSI = "No CSI structure available"
    -
    341 | errorText EL2HLT = "Level 2 halted"
    -
    342 | errorText EBADE = "Invalid exchange"
    -
    343 | errorText EBADR = "Invalid request descriptor"
    -
    344 | errorText EXFULL = "Exchange full"
    -
    345 | errorText ENOANO = "No anode"
    -
    346 | errorText EBADRQC = "Invalid request code"
    -
    347 | errorText EBADSLT = "Invalid slot"
    -
    348 | errorText EDEADLOCK = "Resource deadlock avoided"
    -
    349 | errorText EBFONT = "Bad font file format"
    -
    350 | errorText ENOSTR = "Device not a stream"
    -
    351 | errorText ENODATA = "No data available"
    -
    352 | errorText ETIME = "Timer expired"
    -
    353 | errorText ENOSR = "Out of streams resources"
    -
    354 | errorText ENONET = "Machine is not on the network"
    -
    355 | errorText ENOPKG = "Package not installed"
    -
    356 | errorText EREMOTE = "Object is remote"
    -
    357 | errorText ENOLINK = "Link has been severed"
    -
    358 | errorText EADV = "Advertise error"
    -
    359 | errorText ESRMNT = "Srmount error"
    -
    360 | errorText ECOMM = "Communication error on send"
    -
    361 | errorText EPROTO = "Protocol error"
    -
    362 | errorText EMULTIHOP = "Multihop attempted"
    -
    363 | errorText EDOTDOT = "RFS specific error"
    -
    364 | errorText EBADMSG = "Bad message"
    -
    365 | errorText EOVERFLOW = "Value too large for defined data type"
    -
    366 | errorText ENOTUNIQ = "Name not unique on network"
    -
    367 | errorText EBADFD = "File descriptor in bad state"
    -
    368 | errorText EREMCHG = "Remote address changed"
    -
    369 | errorText ELIBACC = "Can not access a needed shared library"
    -
    370 | errorText ELIBBAD = "Accessing a corrupted shared library"
    -
    371 | errorText ELIBSCN = ".lib section in a.out corrupted"
    -
    372 | errorText ELIBMAX = "Attempting to link in too many shared libraries"
    -
    373 | errorText ELIBEXEC = "Cannot exec a shared library directly"
    -
    374 | errorText EILSEQ = "Invalid or incomplete multibyte or wide character"
    -
    375 | errorText ERESTART = "Interrupted system call should be restarted"
    -
    376 | errorText ESTRPIPE = "Streams pipe error"
    -
    377 | errorText EUSERS = "Too many users"
    -
    378 | errorText ENOTSOCK = "Socket operation on non-socket"
    -
    379 | errorText EDESTADDRREQ = "Destination address required"
    -
    380 | errorText EMSGSIZE = "Message too long"
    -
    381 | errorText EPROTOTYPE = "Protocol wrong type for socket"
    -
    382 | errorText ENOPROTOOPT = "Protocol not available"
    -
    383 | errorText EPROTONOSUPPORT = "Protocol not supported"
    -
    384 | errorText ESOCKTNOSUPPORT = "Socket type not supported"
    -
    385 | errorText EOPNOTSUPP = "Operation not supported"
    -
    386 | errorText EPFNOSUPPORT = "Protocol family not supported"
    -
    387 | errorText EAFNOSUPPORT = "Address family not supported by protocol"
    -
    388 | errorText EADDRINUSE = "Address already in use"
    -
    389 | errorText EADDRNOTAVAIL = "Cannot assign requested address"
    -
    390 | errorText ENETDOWN = "Network is down"
    -
    391 | errorText ENETUNREACH = "Network is unreachable"
    -
    392 | errorText ENETRESET = "Network dropped connection on reset"
    -
    393 | errorText ECONNABORTED = "Software caused connection abort"
    -
    394 | errorText ECONNRESET = "Connection reset by peer"
    -
    395 | errorText ENOBUFS = "No buffer space available"
    -
    396 | errorText EISCONN = "Transport endpoint is already connected"
    -
    397 | errorText ENOTCONN = "Transport endpoint is not connected"
    -
    398 | errorText ESHUTDOWN = "Cannot send after transport endpoint shutdown"
    -
    399 | errorText ETOOMANYREFS = "Too many references: cannot splice"
    -
    400 | errorText ETIMEDOUT = "Connection timed out"
    -
    401 | errorText ECONNREFUSED = "Connection refused"
    -
    402 | errorText EHOSTDOWN = "Host is down"
    -
    403 | errorText EHOSTUNREACH = "No route to host"
    -
    404 | errorText EALREADY = "Operation already in progress"
    -
    405 | errorText EINPROGRESS = "Operation now in progress"
    -
    406 | errorText ESTALE = "Stale file handle"
    -
    407 | errorText EUCLEAN = "Structure needs cleaning"
    -
    408 | errorText ENOTNAM = "Not a XENIX named type file"
    -
    409 | errorText ENAVAIL = "No XENIX semaphores available"
    -
    410 | errorText EISNAM = "Is a named type file"
    -
    411 | errorText EREMOTEIO = "Remote I/O error"
    -
    412 | errorText EDQUOT = "Disk quota exceeded"
    -
    413 | errorText ENOMEDIUM = "No medium found"
    -
    414 | errorText EMEDIUMTYPE = "Wrong medium type"
    -
    415 | errorText ECANCELED = "Operation canceled"
    -
    416 | errorText ENOKEY = "Required key not available"
    -
    417 | errorText EKEYEXPIRED = "Key has expired"
    -
    418 | errorText EKEYREVOKED = "Key has been revoked"
    -
    419 | errorText EKEYREJECTED = "Key was rejected by service"
    -
    420 | errorText EOWNERDEAD = "Owner died"
    -
    421 | errorText ENOTRECOVERABLE = "State not recoverable"
    -
    422 | errorText ERFKILL = "Operation not possible due to RF-kill"
    -
    423 | errorText EHWPOISON = "Memory page has hardware error"
    -
    424 | errorText EOTHER = "Other (unknown) error"
    - +
    152 | public export %inline
    +
    153 | EDOM : Errno
    +
    154 | EDOM = 33
    + +
    156 | public export %inline
    +
    157 | ERANGE : Errno
    +
    158 | ERANGE = 34
    + +
    160 | public export %inline
    +
    161 | EDEADLK : Errno
    +
    162 | EDEADLK = 35
    + +
    164 | public export %inline
    +
    165 | ENAMETOOLONG : Errno
    +
    166 | ENAMETOOLONG = 36
    + +
    168 | public export %inline
    +
    169 | ENOLCK : Errno
    +
    170 | ENOLCK = 37
    + +
    172 | public export %inline
    +
    173 | ENOSYS : Errno
    +
    174 | ENOSYS = 38
    + +
    176 | public export %inline
    +
    177 | ENOTEMPTY : Errno
    +
    178 | ENOTEMPTY = 39
    + +
    180 | public export %inline
    +
    181 | ELOOP : Errno
    +
    182 | ELOOP = 40
    + +
    184 | public export %inline
    +
    185 | ENOMSG : Errno
    +
    186 | ENOMSG = 42
    + +
    188 | public export %inline
    +
    189 | EIDRM : Errno
    +
    190 | EIDRM = 43
    + +
    192 | public export %inline
    +
    193 | ECHRNG : Errno
    +
    194 | ECHRNG = 44
    + +
    196 | public export %inline
    +
    197 | EL2NSYNC : Errno
    +
    198 | EL2NSYNC = 45
    + +
    200 | public export %inline
    +
    201 | EL3HLT : Errno
    +
    202 | EL3HLT = 46
    + +
    204 | public export %inline
    +
    205 | EL3RST : Errno
    +
    206 | EL3RST = 47
    + +
    208 | public export %inline
    +
    209 | ELNRNG : Errno
    +
    210 | ELNRNG = 48
    + +
    212 | public export %inline
    +
    213 | EUNATCH : Errno
    +
    214 | EUNATCH = 49
    + +
    216 | public export %inline
    +
    217 | ENOCSI : Errno
    +
    218 | ENOCSI = 50
    + +
    220 | public export %inline
    +
    221 | EL2HLT : Errno
    +
    222 | EL2HLT = 51
    + +
    224 | public export %inline
    +
    225 | EBADE : Errno
    +
    226 | EBADE = 52
    + +
    228 | public export %inline
    +
    229 | EBADR : Errno
    +
    230 | EBADR = 53
    + +
    232 | public export %inline
    +
    233 | EXFULL : Errno
    +
    234 | EXFULL = 54
    + +
    236 | public export %inline
    +
    237 | ENOANO : Errno
    +
    238 | ENOANO = 55
    + +
    240 | public export %inline
    +
    241 | EBADRQC : Errno
    +
    242 | EBADRQC = 56
    + +
    244 | public export %inline
    +
    245 | EBADSLT : Errno
    +
    246 | EBADSLT = 57
    + +
    248 | public export %inline
    +
    249 | EBFONT : Errno
    +
    250 | EBFONT = 59
    + +
    252 | public export %inline
    +
    253 | ENOSTR : Errno
    +
    254 | ENOSTR = 60
    + +
    256 | public export %inline
    +
    257 | ENODATA : Errno
    +
    258 | ENODATA = 61
    + +
    260 | public export %inline
    +
    261 | ETIME : Errno
    +
    262 | ETIME = 62
    + +
    264 | public export %inline
    +
    265 | ENOSR : Errno
    +
    266 | ENOSR = 63
    + +
    268 | public export %inline
    +
    269 | ENONET : Errno
    +
    270 | ENONET = 64
    + +
    272 | public export %inline
    +
    273 | ENOPKG : Errno
    +
    274 | ENOPKG = 65
    + +
    276 | public export %inline
    +
    277 | EREMOTE : Errno
    +
    278 | EREMOTE = 66
    + +
    280 | public export %inline
    +
    281 | ENOLINK : Errno
    +
    282 | ENOLINK = 67
    + +
    284 | public export %inline
    +
    285 | EADV : Errno
    +
    286 | EADV = 68
    + +
    288 | public export %inline
    +
    289 | ESRMNT : Errno
    +
    290 | ESRMNT = 69
    + +
    292 | public export %inline
    +
    293 | ECOMM : Errno
    +
    294 | ECOMM = 70
    + +
    296 | public export %inline
    +
    297 | EPROTO : Errno
    +
    298 | EPROTO = 71
    + +
    300 | public export %inline
    +
    301 | EMULTIHOP : Errno
    +
    302 | EMULTIHOP = 72
    + +
    304 | public export %inline
    +
    305 | EDOTDOT : Errno
    +
    306 | EDOTDOT = 73
    + +
    308 | public export %inline
    +
    309 | EBADMSG : Errno
    +
    310 | EBADMSG = 74
    + +
    312 | public export %inline
    +
    313 | EOVERFLOW : Errno
    +
    314 | EOVERFLOW = 75
    + +
    316 | public export %inline
    +
    317 | ENOTUNIQ : Errno
    +
    318 | ENOTUNIQ = 76
    + +
    320 | public export %inline
    +
    321 | EBADFD : Errno
    +
    322 | EBADFD = 77
    + +
    324 | public export %inline
    +
    325 | EREMCHG : Errno
    +
    326 | EREMCHG = 78
    + +
    328 | public export %inline
    +
    329 | ELIBACC : Errno
    +
    330 | ELIBACC = 79
    + +
    332 | public export %inline
    +
    333 | ELIBBAD : Errno
    +
    334 | ELIBBAD = 80
    + +
    336 | public export %inline
    +
    337 | ELIBSCN : Errno
    +
    338 | ELIBSCN = 81
    + +
    340 | public export %inline
    +
    341 | ELIBMAX : Errno
    +
    342 | ELIBMAX = 82
    + +
    344 | public export %inline
    +
    345 | ELIBEXEC : Errno
    +
    346 | ELIBEXEC = 83
    + +
    348 | public export %inline
    +
    349 | EILSEQ : Errno
    +
    350 | EILSEQ = 84
    + +
    352 | public export %inline
    +
    353 | ERESTART : Errno
    +
    354 | ERESTART = 85
    + +
    356 | public export %inline
    +
    357 | ESTRPIPE : Errno
    +
    358 | ESTRPIPE = 86
    + +
    360 | public export %inline
    +
    361 | EUSERS : Errno
    +
    362 | EUSERS = 87
    + +
    364 | public export %inline
    +
    365 | ENOTSOCK : Errno
    +
    366 | ENOTSOCK = 88
    + +
    368 | public export %inline
    +
    369 | EDESTADDRREQ : Errno
    +
    370 | EDESTADDRREQ = 89
    + +
    372 | public export %inline
    +
    373 | EMSGSIZE : Errno
    +
    374 | EMSGSIZE = 90
    + +
    376 | public export %inline
    +
    377 | EPROTOTYPE : Errno
    +
    378 | EPROTOTYPE = 91
    + +
    380 | public export %inline
    +
    381 | ENOPROTOOPT : Errno
    +
    382 | ENOPROTOOPT = 92
    + +
    384 | public export %inline
    +
    385 | EPROTONOSUPPORT : Errno
    +
    386 | EPROTONOSUPPORT = 93
    + +
    388 | public export %inline
    +
    389 | ESOCKTNOSUPPORT : Errno
    +
    390 | ESOCKTNOSUPPORT = 94
    + +
    392 | public export %inline
    +
    393 | EOPNOTSUPP : Errno
    +
    394 | EOPNOTSUPP = 95
    + +
    396 | public export %inline
    +
    397 | EPFNOSUPPORT : Errno
    +
    398 | EPFNOSUPPORT = 96
    + +
    400 | public export %inline
    +
    401 | EAFNOSUPPORT : Errno
    +
    402 | EAFNOSUPPORT = 97
    + +
    404 | public export %inline
    +
    405 | EADDRINUSE : Errno
    +
    406 | EADDRINUSE = 98
    + +
    408 | public export %inline
    +
    409 | EADDRNOTAVAIL : Errno
    +
    410 | EADDRNOTAVAIL = 99
    + +
    412 | public export %inline
    +
    413 | ENETDOWN : Errno
    +
    414 | ENETDOWN = 100
    + +
    416 | public export %inline
    +
    417 | ENETUNREACH : Errno
    +
    418 | ENETUNREACH = 101
    + +
    420 | public export %inline
    +
    421 | ENETRESET : Errno
    +
    422 | ENETRESET = 102
    + +
    424 | public export %inline
    +
    425 | ECONNABORTED : Errno
    +
    426 | ECONNABORTED = 103
    + +
    428 | public export %inline
    +
    429 | ECONNRESET : Errno
    +
    430 | ECONNRESET = 104
    + +
    432 | public export %inline
    +
    433 | ENOBUFS : Errno
    +
    434 | ENOBUFS = 105
    + +
    436 | public export %inline
    +
    437 | EISCONN : Errno
    +
    438 | EISCONN = 106
    + +
    440 | public export %inline
    +
    441 | ENOTCONN : Errno
    +
    442 | ENOTCONN = 107
    + +
    444 | public export %inline
    +
    445 | ESHUTDOWN : Errno
    +
    446 | ESHUTDOWN = 108
    + +
    448 | public export %inline
    +
    449 | ETOOMANYREFS : Errno
    +
    450 | ETOOMANYREFS = 109
    + +
    452 | public export %inline
    +
    453 | ETIMEDOUT : Errno
    +
    454 | ETIMEDOUT = 110
    + +
    456 | public export %inline
    +
    457 | ECONNREFUSED : Errno
    +
    458 | ECONNREFUSED = 111
    + +
    460 | public export %inline
    +
    461 | EHOSTDOWN : Errno
    +
    462 | EHOSTDOWN = 112
    + +
    464 | public export %inline
    +
    465 | EHOSTUNREACH : Errno
    +
    466 | EHOSTUNREACH = 113
    + +
    468 | public export %inline
    +
    469 | EALREADY : Errno
    +
    470 | EALREADY = 114
    + +
    472 | public export %inline
    +
    473 | EINPROGRESS : Errno
    +
    474 | EINPROGRESS = 115
    + +
    476 | public export %inline
    +
    477 | ESTALE : Errno
    +
    478 | ESTALE = 116
    + +
    480 | public export %inline
    +
    481 | EUCLEAN : Errno
    +
    482 | EUCLEAN = 117
    + +
    484 | public export %inline
    +
    485 | ENOTNAM : Errno
    +
    486 | ENOTNAM = 118
    + +
    488 | public export %inline
    +
    489 | ENAVAIL : Errno
    +
    490 | ENAVAIL = 119
    + +
    492 | public export %inline
    +
    493 | EISNAM : Errno
    +
    494 | EISNAM = 120
    + +
    496 | public export %inline
    +
    497 | EREMOTEIO : Errno
    +
    498 | EREMOTEIO = 121
    + +
    500 | public export %inline
    +
    501 | EDQUOT : Errno
    +
    502 | EDQUOT = 122
    + +
    504 | public export %inline
    +
    505 | ENOMEDIUM : Errno
    +
    506 | ENOMEDIUM = 123
    + +
    508 | public export %inline
    +
    509 | EMEDIUMTYPE : Errno
    +
    510 | EMEDIUMTYPE = 124
    + +
    512 | public export %inline
    +
    513 | ECANCELED : Errno
    +
    514 | ECANCELED = 125
    + +
    516 | public export %inline
    +
    517 | ENOKEY : Errno
    +
    518 | ENOKEY = 126
    + +
    520 | public export %inline
    +
    521 | EKEYEXPIRED : Errno
    +
    522 | EKEYEXPIRED = 127
    + +
    524 | public export %inline
    +
    525 | EKEYREVOKED : Errno
    +
    526 | EKEYREVOKED = 128
    + +
    528 | public export %inline
    +
    529 | EKEYREJECTED : Errno
    +
    530 | EKEYREJECTED = 129
    + +
    532 | public export %inline
    +
    533 | EOWNERDEAD : Errno
    +
    534 | EOWNERDEAD = 130
    + +
    536 | public export %inline
    +
    537 | ENOTRECOVERABLE : Errno
    +
    538 | ENOTRECOVERABLE = 131
    + +
    540 | public export %inline
    +
    541 | ERFKILL : Errno
    +
    542 | ERFKILL = 132
    + +
    544 | public export %inline
    +
    545 | EHWPOISON : Errno
    +
    546 | EHWPOISON = 133
    + +
    548 | export
    +
    549 | errorText : Errno -> String
    +
    550 | errorText 1 = "Operation not permitted"
    +
    551 | errorText 2 = "No such file or directory"
    +
    552 | errorText 3 = "No such process"
    +
    553 | errorText 4 = "Interrupted system call"
    +
    554 | errorText 5 = "Input/output error"
    +
    555 | errorText 6 = "No such device or address"
    +
    556 | errorText 7 = "Argument list too long"
    +
    557 | errorText 8 = "Exec format error"
    +
    558 | errorText 9 = "Bad file descriptor"
    +
    559 | errorText 10 = "No child processes"
    +
    560 | errorText 11 = "Resource temporarily unavailable"
    +
    561 | errorText 12 = "Cannot allocate memory"
    +
    562 | errorText 13 = "Permission denied"
    +
    563 | errorText 14 = "Bad address"
    +
    564 | errorText 15 = "Block device required"
    +
    565 | errorText 16 = "Device or resource busy"
    +
    566 | errorText 17 = "File exists"
    +
    567 | errorText 18 = "Invalid cross-device link"
    +
    568 | errorText 19 = "No such device"
    +
    569 | errorText 20 = "Not a directory"
    +
    570 | errorText 21 = "Is a directory"
    +
    571 | errorText 22 = "Invalid argument"
    +
    572 | errorText 23 = "Too many open files in system"
    +
    573 | errorText 24 = "Too many open files"
    +
    574 | errorText 25 = "Inappropriate ioctl for device"
    +
    575 | errorText 26 = "Text file busy"
    +
    576 | errorText 27 = "File too large"
    +
    577 | errorText 28 = "No space left on device"
    +
    578 | errorText 29 = "Illegal seek"
    +
    579 | errorText 30 = "Read-only file system"
    +
    580 | errorText 31 = "Too many links"
    +
    581 | errorText 32 = "Broken pipe"
    +
    582 | errorText 33 = "Numerical argument out of domain"
    +
    583 | errorText 34 = "Numerical result out of range"
    +
    584 | errorText 35 = "Resource deadlock avoided"
    +
    585 | errorText 36 = "File name too long"
    +
    586 | errorText 37 = "No locks available"
    +
    587 | errorText 38 = "Function not implemented"
    +
    588 | errorText 39 = "Directory not empty"
    +
    589 | errorText 40 = "Too many levels of symbolic links"
    +
    590 | errorText 42 = "No message of desired type"
    +
    591 | errorText 43 = "Identifier removed"
    +
    592 | errorText 44 = "Channel number out of range"
    +
    593 | errorText 45 = "Level 2 not synchronized"
    +
    594 | errorText 46 = "Level 3 halted"
    +
    595 | errorText 47 = "Level 3 reset"
    +
    596 | errorText 48 = "Link number out of range"
    +
    597 | errorText 49 = "Protocol driver not attached"
    +
    598 | errorText 50 = "No CSI structure available"
    +
    599 | errorText 51 = "Level 2 halted"
    +
    600 | errorText 52 = "Invalid exchange"
    +
    601 | errorText 53 = "Invalid request descriptor"
    +
    602 | errorText 54 = "Exchange full"
    +
    603 | errorText 55 = "No anode"
    +
    604 | errorText 56 = "Invalid request code"
    +
    605 | errorText 57 = "Invalid slot"
    +
    606 | errorText 59 = "Bad font file format"
    +
    607 | errorText 60 = "Device not a stream"
    +
    608 | errorText 61 = "No data available"
    +
    609 | errorText 62 = "Timer expired"
    +
    610 | errorText 63 = "Out of streams resources"
    +
    611 | errorText 64 = "Machine is not on the network"
    +
    612 | errorText 65 = "Package not installed"
    +
    613 | errorText 66 = "Object is remote"
    +
    614 | errorText 67 = "Link has been severed"
    +
    615 | errorText 68 = "Advertise error"
    +
    616 | errorText 69 = "Srmount error"
    +
    617 | errorText 70 = "Communication error on send"
    +
    618 | errorText 71 = "Protocol error"
    +
    619 | errorText 72 = "Multihop attempted"
    +
    620 | errorText 73 = "RFS specific error"
    +
    621 | errorText 74 = "Bad message"
    +
    622 | errorText 75 = "Value too large for defined data type"
    +
    623 | errorText 76 = "Name not unique on network"
    +
    624 | errorText 77 = "File descriptor in bad state"
    +
    625 | errorText 78 = "Remote address changed"
    +
    626 | errorText 79 = "Can not access a needed shared library"
    +
    627 | errorText 80 = "Accessing a corrupted shared library"
    +
    628 | errorText 81 = ".lib section in a.out corrupted"
    +
    629 | errorText 82 = "Attempting to link in too many shared libraries"
    +
    630 | errorText 83 = "Cannot exec a shared library directly"
    +
    631 | errorText 84 = "Invalid or incomplete multibyte or wide character"
    +
    632 | errorText 85 = "Interrupted system call should be restarted"
    +
    633 | errorText 86 = "Streams pipe error"
    +
    634 | errorText 87 = "Too many users"
    +
    635 | errorText 88 = "Socket operation on non-socket"
    +
    636 | errorText 89 = "Destination address required"
    +
    637 | errorText 90 = "Message too long"
    +
    638 | errorText 91 = "Protocol wrong type for socket"
    +
    639 | errorText 92 = "Protocol not available"
    +
    640 | errorText 93 = "Protocol not supported"
    +
    641 | errorText 94 = "Socket type not supported"
    +
    642 | errorText 95 = "Operation not supported"
    +
    643 | errorText 96 = "Protocol family not supported"
    +
    644 | errorText 97 = "Address family not supported by protocol"
    +
    645 | errorText 98 = "Address already in use"
    +
    646 | errorText 99 = "Cannot assign requested address"
    +
    647 | errorText 100 = "Network is down"
    +
    648 | errorText 101 = "Network is unreachable"
    +
    649 | errorText 102 = "Network dropped connection on reset"
    +
    650 | errorText 103 = "Software caused connection abort"
    +
    651 | errorText 104 = "Connection reset by peer"
    +
    652 | errorText 105 = "No buffer space available"
    +
    653 | errorText 106 = "Transport endpoint is already connected"
    +
    654 | errorText 107 = "Transport endpoint is not connected"
    +
    655 | errorText 108 = "Cannot send after transport endpoint shutdown"
    +
    656 | errorText 109 = "Too many references: cannot splice"
    +
    657 | errorText 110 = "Connection timed out"
    +
    658 | errorText 111 = "Connection refused"
    +
    659 | errorText 112 = "Host is down"
    +
    660 | errorText 113 = "No route to host"
    +
    661 | errorText 114 = "Operation already in progress"
    +
    662 | errorText 115 = "Operation now in progress"
    +
    663 | errorText 116 = "Stale file handle"
    +
    664 | errorText 117 = "Structure needs cleaning"
    +
    665 | errorText 118 = "Not a XENIX named type file"
    +
    666 | errorText 119 = "No XENIX semaphores available"
    +
    667 | errorText 120 = "Is a named type file"
    +
    668 | errorText 121 = "Remote I/O error"
    +
    669 | errorText 122 = "Disk quota exceeded"
    +
    670 | errorText 123 = "No medium found"
    +
    671 | errorText 124 = "Wrong medium type"
    +
    672 | errorText 125 = "Operation canceled"
    +
    673 | errorText 126 = "Required key not available"
    +
    674 | errorText 127 = "Key has expired"
    +
    675 | errorText 128 = "Key has been revoked"
    +
    676 | errorText 129 = "Key was rejected by service"
    +
    677 | errorText 130 = "Owner died"
    +
    678 | errorText 131 = "State not recoverable"
    +
    679 | errorText 132 = "Operation not possible due to RF-kill"
    +
    680 | errorText 133 = "Memory page has hardware error"
    +
    681 | errorText (EN x) = "Unknown error: \{show x}"
    + +
    683 | export
    +
    684 | errorName : Errno -> String
    +
    685 | errorName 1 = "EPERM"
    +
    686 | errorName 2 = "ENOENT"
    +
    687 | errorName 3 = "ESRCH"
    +
    688 | errorName 4 = "EINTR"
    +
    689 | errorName 5 = "EIO"
    +
    690 | errorName 6 = "ENXIO"
    +
    691 | errorName 7 = "E2BIG"
    +
    692 | errorName 8 = "ENOEXEC"
    +
    693 | errorName 9 = "EBADF"
    +
    694 | errorName 10 = "ECHILD"
    +
    695 | errorName 11 = "EAGAIN"
    +
    696 | errorName 12 = "ENOMEM"
    +
    697 | errorName 13 = "EACCES"
    +
    698 | errorName 14 = "EFAULT"
    +
    699 | errorName 15 = "ENOTBLK"
    +
    700 | errorName 16 = "EBUSY"
    +
    701 | errorName 17 = "EEXIST"
    +
    702 | errorName 18 = "EXDEV"
    +
    703 | errorName 19 = "ENODEV"
    +
    704 | errorName 20 = "ENOTDIR"
    +
    705 | errorName 21 = "EISDIR"
    +
    706 | errorName 22 = "EINVAL"
    +
    707 | errorName 23 = "ENFILE"
    +
    708 | errorName 24 = "EMFILE"
    +
    709 | errorName 25 = "ENOTTY"
    +
    710 | errorName 26 = "ETXTBSY"
    +
    711 | errorName 27 = "EFBIG"
    +
    712 | errorName 28 = "ENOSPC"
    +
    713 | errorName 29 = "ESPIPE"
    +
    714 | errorName 30 = "EROFS"
    +
    715 | errorName 31 = "EMLINK"
    +
    716 | errorName 32 = "EPIPE"
    +
    717 | errorName 33 = "EDOM"
    +
    718 | errorName 34 = "ERANGE"
    +
    719 | errorName 35 = "EDEADLK"
    +
    720 | errorName 36 = "ENAMETOOLONG"
    +
    721 | errorName 37 = "ENOLCK"
    +
    722 | errorName 38 = "ENOSYS"
    +
    723 | errorName 39 = "ENOTEMPTY"
    +
    724 | errorName 40 = "ELOOP"
    +
    725 | errorName 42 = "ENOMSG"
    +
    726 | errorName 43 = "EIDRM"
    +
    727 | errorName 44 = "ECHRNG"
    +
    728 | errorName 45 = "EL2NSYNC"
    +
    729 | errorName 46 = "EL3HLT"
    +
    730 | errorName 47 = "EL3RST"
    +
    731 | errorName 48 = "ELNRNG"
    +
    732 | errorName 49 = "EUNATCH"
    +
    733 | errorName 50 = "ENOCSI"
    +
    734 | errorName 51 = "EL2HLT"
    +
    735 | errorName 52 = "EBADE"
    +
    736 | errorName 53 = "EBADR"
    +
    737 | errorName 54 = "EXFULL"
    +
    738 | errorName 55 = "ENOANO"
    +
    739 | errorName 56 = "EBADRQC"
    +
    740 | errorName 57 = "EBADSLT"
    +
    741 | errorName 59 = "EBFONT"
    +
    742 | errorName 60 = "ENOSTR"
    +
    743 | errorName 61 = "ENODATA"
    +
    744 | errorName 62 = "ETIME"
    +
    745 | errorName 63 = "ENOSR"
    +
    746 | errorName 64 = "ENONET"
    +
    747 | errorName 65 = "ENOPKG"
    +
    748 | errorName 66 = "EREMOTE"
    +
    749 | errorName 67 = "ENOLINK"
    +
    750 | errorName 68 = "EADV"
    +
    751 | errorName 69 = "ESRMNT"
    +
    752 | errorName 70 = "ECOMM"
    +
    753 | errorName 71 = "EPROTO"
    +
    754 | errorName 72 = "EMULTIHOP"
    +
    755 | errorName 73 = "EDOTDOT"
    +
    756 | errorName 74 = "EBADMSG"
    +
    757 | errorName 75 = "EOVERFLOW"
    +
    758 | errorName 76 = "ENOTUNIQ"
    +
    759 | errorName 77 = "EBADFD"
    +
    760 | errorName 78 = "EREMCHG"
    +
    761 | errorName 79 = "ELIBACC"
    +
    762 | errorName 80 = "ELIBBAD"
    +
    763 | errorName 81 = "ELIBSCN"
    +
    764 | errorName 82 = "ELIBMAX"
    +
    765 | errorName 83 = "ELIBEXEC"
    +
    766 | errorName 84 = "EILSEQ"
    +
    767 | errorName 85 = "ERESTART"
    +
    768 | errorName 86 = "ESTRPIPE"
    +
    769 | errorName 87 = "EUSERS"
    +
    770 | errorName 88 = "ENOTSOCK"
    +
    771 | errorName 89 = "EDESTADDRREQ"
    +
    772 | errorName 90 = "EMSGSIZE"
    +
    773 | errorName 91 = "EPROTOTYPE"
    +
    774 | errorName 92 = "ENOPROTOOPT"
    +
    775 | errorName 93 = "EPROTONOSUPPORT"
    +
    776 | errorName 94 = "ESOCKTNOSUPPORT"
    +
    777 | errorName 95 = "EOPNOTSUPP"
    +
    778 | errorName 96 = "EPFNOSUPPORT"
    +
    779 | errorName 97 = "EAFNOSUPPORT"
    +
    780 | errorName 98 = "EADDRINUSE"
    +
    781 | errorName 99 = "EADDRNOTAVAIL"
    +
    782 | errorName 100 = "ENETDOWN"
    +
    783 | errorName 101 = "ENETUNREACH"
    +
    784 | errorName 102 = "ENETRESET"
    +
    785 | errorName 103 = "ECONNABORTED"
    +
    786 | errorName 104 = "ECONNRESET"
    +
    787 | errorName 105 = "ENOBUFS"
    +
    788 | errorName 106 = "EISCONN"
    +
    789 | errorName 107 = "ENOTCONN"
    +
    790 | errorName 108 = "ESHUTDOWN"
    +
    791 | errorName 109 = "ETOOMANYREFS"
    +
    792 | errorName 110 = "ETIMEDOUT"
    +
    793 | errorName 111 = "ECONNREFUSED"
    +
    794 | errorName 112 = "EHOSTDOWN"
    +
    795 | errorName 113 = "EHOSTUNREACH"
    +
    796 | errorName 114 = "EALREADY"
    +
    797 | errorName 115 = "EINPROGRESS"
    +
    798 | errorName 116 = "ESTALE"
    +
    799 | errorName 117 = "EUCLEAN"
    +
    800 | errorName 118 = "ENOTNAM"
    +
    801 | errorName 119 = "ENAVAIL"
    +
    802 | errorName 120 = "EISNAM"
    +
    803 | errorName 121 = "EREMOTEIO"
    +
    804 | errorName 122 = "EDQUOT"
    +
    805 | errorName 123 = "ENOMEDIUM"
    +
    806 | errorName 124 = "EMEDIUMTYPE"
    +
    807 | errorName 125 = "ECANCELED"
    +
    808 | errorName 126 = "ENOKEY"
    +
    809 | errorName 127 = "EKEYEXPIRED"
    +
    810 | errorName 128 = "EKEYREVOKED"
    +
    811 | errorName 129 = "EKEYREJECTED"
    +
    812 | errorName 130 = "EOWNERDEAD"
    +
    813 | errorName 131 = "ENOTRECOVERABLE"
    +
    814 | errorName 132 = "ERFKILL"
    +
    815 | errorName 133 = "EHWPOISON"
    +
    816 | errorName (EN _) = "EUNKNOWN"
    + diff --git a/docs/posix/docs/docs/System.Posix.Errno.html b/docs/posix/docs/docs/System.Posix.Errno.html index e5bd4c03b..eb235c44a 100644 --- a/docs/posix/docs/docs/System.Posix.Errno.html +++ b/docs/posix/docs/docs/System.Posix.Errno.html @@ -61,4 +61,4 @@ -

    System.Posix.Errno

    (source)

    Reexports

    importpublic System.Posix.Errno.Type

    Definitions

    toBool : Bits8->Bool
    Visibility: public export
    fromCode : Bits32->Errno
      Convert an error code to the corresponding `Errno`.

    This returns `EOTHER` in case `x` is none of the predefined error
    codes.

    Totality: total
    Visibility: export
    fromNeg : Negn=>CastnBits32=>n->Errno
    Totality: total
    Visibility: export
    negErr : Negn=>CastnBits32=>n->EitherErrnoa
    Totality: total
    Visibility: export
    toSize : PrimIOSsizeT->IO (EitherErrnoBits32)
    Totality: total
    Visibility: export
    toUnit : PrimIOCInt->IO (EitherErrno ())
    Totality: total
    Visibility: export
    toPidT : PrimIOPidT->IO (EitherErrnoPidT)
    Totality: total
    Visibility: export
    posToUnit : PrimIOBits32->IO (EitherErrno ())
    Totality: total
    Visibility: export
    toRes : IOa->PrimIOCInt->IO (EitherErrnoa)
    Totality: total
    Visibility: export
    toVal : (CInt->a) ->PrimIOCInt->IO (EitherErrnoa)
    Totality: total
    Visibility: export
    primMap : (a->b) ->PrimIOa->PrimIOb
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Errno

    (source)

    Reexports

    importpublic System.Posix.Errno.Type

    Definitions

    toBool : Bits8->Bool
    Visibility: public export
    fromNeg : Negn=>CastnBits32=>n->Errno
    Visibility: export
    interfaceErrIO : (Type->Type) ->Type
    Parameters: io
    Constraints: HasIO io
    Methods:
    error : Errno->ioa
    error : ErrIOio=>Errno->ioa
    Visibility: public export
    toSize : ErrIOio=>PrimIOSsizeT->ioBits32
    Visibility: export
    toUnit : ErrIOio=>PrimIOCInt->io ()
    Visibility: export
    toPidT : ErrIOio=>PrimIOPidT->ioPidT
    Visibility: export
    posToUnit : ErrIOio=>PrimIOBits32->io ()
    Visibility: export
    toRes : ErrIOio=>ioa->PrimIOCInt->ioa
    Visibility: export
    toVal : ErrIOio=> (CInt->a) ->PrimIOCInt->ioa
    Visibility: export
    primMap : HasIOio=> (a->b) ->PrimIOa->iob
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Errno.src.html b/docs/posix/docs/docs/System.Posix.Errno.src.html index f5183187d..7f870bad3 100644 --- a/docs/posix/docs/docs/System.Posix.Errno.src.html +++ b/docs/posix/docs/docs/System.Posix.Errno.src.html @@ -137,84 +137,55 @@
    17 | export %inline
    18 | Interpolation Errno where
    -
    19 |   interpolate = errorText
    +
    19 |   interpolate x = "\{errorText x} (\{errorName x})"
    -
    21 | %default total
    -
    22 | codeMap : SortedMap Bits32 Errno
    -
    23 | codeMap = SortedMap.fromList $ map (\x => (errorCode x, x)) values
    +
    21 | export %inline
    +
    22 | fromNeg : Neg n => Cast n Bits32 => n -> Errno
    +
    23 | fromNeg = EN . cast . negate
    -
    25 | ||| Convert an error code to the corresponding `Errno`.
    - -
    27 | ||| This returns `EOTHER` in case `x` is none of the predefined error
    -
    28 | ||| codes.
    -
    29 | export
    -
    30 | fromCode : Bits32 -> Errno
    -
    31 | fromCode x = fromMaybe EOTHER (lookup x codeMap)
    - -
    33 | export %inline
    -
    34 | fromNeg : Neg n => Cast n Bits32 => n -> Errno
    -
    35 | fromNeg = fromCode . cast . negate
    - -
    37 | export %inline
    -
    38 | negErr : Neg n => Cast n Bits32 => n -> Either Errno a
    -
    39 | negErr x = Left (fromNeg x)
    - -
    41 | export %inline
    -
    42 | toSize : PrimIO SsizeT -> IO (Either Errno Bits32)
    -
    43 | toSize act =
    -
    44 |   fromPrim $ \w =>
    -
    45 |     let MkIORes r w := act w
    -
    46 |      in case r < 0 of
    -
    47 |           True  => MkIORes (negErr r) w
    -
    48 |           False => MkIORes (Right $ cast r) w
    - -
    50 | export %inline
    -
    51 | toUnit : PrimIO CInt -> IO (Either Errno ())
    -
    52 | toUnit act =
    -
    53 |   fromPrim $ \w =>
    -
    54 |     let MkIORes r w := act w
    -
    55 |      in case r < 0 of
    -
    56 |           True  => MkIORes (negErr r) w
    -
    57 |           False => MkIORes (Right ()) w
    - -
    59 | export %inline
    -
    60 | toPidT : PrimIO PidT -> IO (Either Errno PidT)
    -
    61 | toPidT act =
    -
    62 |   fromPrim $ \w =>
    -
    63 |     let MkIORes r w := act w
    -
    64 |      in case r < 0 of
    -
    65 |           True  => MkIORes (negErr r) w
    -
    66 |           False => MkIORes (Right r) w
    +
    25 | public export
    +
    26 | interface HasIO io => ErrIO io where
    +
    27 |   error : Errno -> io a
    + +
    29 | parameters {auto err : ErrIO io}
    +
    30 |   export %inline
    +
    31 |   toSize : PrimIO SsizeT -> io Bits32
    +
    32 |   toSize act = do
    +
    33 |     r <- primIO act
    +
    34 |     if r < 0 then error (fromNeg r) else pure (cast r)
    + +
    36 |   export %inline
    +
    37 |   toUnit : PrimIO CInt -> io ()
    +
    38 |   toUnit act = do
    +
    39 |     r <- primIO act
    +
    40 |     if r < 0 then error (fromNeg r) else pure ()
    + +
    42 |   export %inline
    +
    43 |   toPidT : PrimIO PidT -> io PidT
    +
    44 |   toPidT act = do
    +
    45 |     r <- primIO act
    +
    46 |     if r < 0 then error (fromNeg r) else pure r
    + +
    48 |   export %inline
    +
    49 |   posToUnit : PrimIO Bits32 -> io ()
    +
    50 |   posToUnit act = do
    +
    51 |     0 <- primIO act | x => error (EN x)
    +
    52 |     pure ()
    + +
    54 |   export %inline
    +
    55 |   toRes : io a -> PrimIO CInt -> io a
    +
    56 |   toRes wrap act = toUnit act >> wrap
    + +
    58 |   export %inline
    +
    59 |   toVal : (CInt -> a) -> PrimIO CInt -> io a
    +
    60 |   toVal wrap act = do
    +
    61 |     r <- primIO act
    +
    62 |     if r < 0 then error (fromNeg r) else pure (wrap r)
    + +
    64 | export %inline
    +
    65 | primMap : HasIO io => (a -> b) -> PrimIO a -> io b
    +
    66 | primMap f act = primIO $ \w => let MkIORes v w := act w in MkIORes (f v) w
    -
    68 | export %inline
    -
    69 | posToUnit : PrimIO Bits32 -> IO (Either Errno ())
    -
    70 | posToUnit act =
    -
    71 |   fromPrim $ \w =>
    -
    72 |     let MkIORes r w := act w
    -
    73 |      in case r of
    -
    74 |           0 => MkIORes (Right ()) w
    -
    75 |           _ => MkIORes (Left $ fromCode r) w
    - -
    77 | export %inline
    -
    78 | toRes : IO a -> PrimIO CInt -> IO (Either Errno a)
    -
    79 | toRes wrap act =
    -
    80 |   toUnit act >>= \case
    -
    81 |     Right () => Right <$> wrap
    -
    82 |     Left x   => pure (Left x)
    - -
    84 | export %inline
    -
    85 | toVal : (CInt -> a) -> PrimIO CInt -> IO (Either Errno a)
    -
    86 | toVal wrap act =
    -
    87 |   fromPrim $ \w =>
    -
    88 |     let MkIORes r w := act w
    -
    89 |      in case r < 0 of
    -
    90 |           True  => MkIORes (negErr r) w
    -
    91 |           False => MkIORes (Right $ wrap r) w
    - -
    93 | export %inline
    -
    94 | primMap : (a -> b) -> PrimIO a -> PrimIO b
    -
    95 | primMap f act w = let MkIORes v w := act w in MkIORes (f v) w
    - diff --git a/docs/posix/docs/docs/System.Posix.File.Flags.html b/docs/posix/docs/docs/System.Posix.File.Flags.html index 72e134495..b7ae262b6 100644 --- a/docs/posix/docs/docs/System.Posix.File.Flags.html +++ b/docs/posix/docs/docs/System.Posix.File.Flags.html @@ -61,4 +61,4 @@ -

    System.Posix.File.Flags

    (source)

    Definitions

    recordFlags : Type
    Totality: total
    Visibility: public export
    Constructor: 
    F : CInt->Flags

    Projection: 
    .flags : Flags->CInt

    Hints:
    EqFlags
    MonoidFlags
    OrdFlags
    SemigroupFlags
    ShowFlags
    .flags : Flags->CInt
    Totality: total
    Visibility: public export
    flags : Flags->CInt
    Totality: total
    Visibility: public export
    O_RDONLY : Flags
    Totality: total
    Visibility: public export
    O_WRONLY : Flags
    Totality: total
    Visibility: public export
    O_RDWR : Flags
    Totality: total
    Visibility: public export
    O_CLOEXEC : Flags
    Totality: total
    Visibility: public export
    O_CREAT : Flags
    Totality: total
    Visibility: public export
    O_DIRECTORY : Flags
    Totality: total
    Visibility: public export
    O_EXCL : Flags
    Totality: total
    Visibility: public export
    O_NOCTTY : Flags
    Totality: total
    Visibility: public export
    O_NOFOLLOW : Flags
    Totality: total
    Visibility: public export
    O_TRUNC : Flags
    Totality: total
    Visibility: public export
    O_APPEND : Flags
    Totality: total
    Visibility: public export
    O_ASYNC : Flags
    Totality: total
    Visibility: public export
    O_DSYNC : Flags
    Totality: total
    Visibility: public export
    O_NONBLOCK : Flags
    Totality: total
    Visibility: public export
    O_SYNC : Flags
    Totality: total
    Visibility: public export
    create : Flags
      Flags for creating a file for output.

    Totality: total
    Visibility: export
    append : Flags
      Flags for creating a file for output.

    If the file exists, data is appended to it.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.File.Flags

    (source)

    Definitions

    recordFlags : Type
    Totality: total
    Visibility: public export
    Constructor: 
    F : Bits32->Flags

    Projection: 
    .flags : Flags->Bits32

    Hints:
    EqFlags
    MonoidFlags
    OrdFlags
    SemigroupFlags
    ShowFlags
    .flags : Flags->Bits32
    Totality: total
    Visibility: public export
    flags : Flags->Bits32
    Totality: total
    Visibility: public export
    O_RDONLY : Flags
    Totality: total
    Visibility: public export
    O_WRONLY : Flags
    Totality: total
    Visibility: public export
    O_RDWR : Flags
    Totality: total
    Visibility: public export
    O_CLOEXEC : Flags
    Totality: total
    Visibility: public export
    O_CREAT : Flags
    Totality: total
    Visibility: public export
    O_DIRECTORY : Flags
    Totality: total
    Visibility: public export
    O_EXCL : Flags
    Totality: total
    Visibility: public export
    O_NOCTTY : Flags
    Totality: total
    Visibility: public export
    O_NOFOLLOW : Flags
    Totality: total
    Visibility: public export
    O_TRUNC : Flags
    Totality: total
    Visibility: public export
    O_APPEND : Flags
    Totality: total
    Visibility: public export
    O_ASYNC : Flags
    Totality: total
    Visibility: public export
    O_DSYNC : Flags
    Totality: total
    Visibility: public export
    O_NONBLOCK : Flags
    Totality: total
    Visibility: public export
    O_SYNC : Flags
    Totality: total
    Visibility: public export
    create : Flags
      Flags for creating a file for output.

    Totality: total
    Visibility: export
    append : Flags
      Flags for creating a file for output.

    If the file exists, data is appended to it.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.File.Flags.src.html b/docs/posix/docs/docs/System.Posix.File.Flags.src.html index f3d5eedf0..3e370f269 100644 --- a/docs/posix/docs/docs/System.Posix.File.Flags.src.html +++ b/docs/posix/docs/docs/System.Posix.File.Flags.src.html @@ -138,7 +138,7 @@
     17 | public export
     18 | record Flags where
     19 |   constructor F
    -
     20 |   flags : CInt
    +
     20 |   flags : Bits32
     22 | %runElab derive "Flags" [Show,Eq,Ord,FromInteger]
    diff --git a/docs/posix/docs/docs/System.Posix.File.Stats.html b/docs/posix/docs/docs/System.Posix.File.Stats.html index 3f2150464..896ff3069 100644 --- a/docs/posix/docs/docs/System.Posix.File.Stats.html +++ b/docs/posix/docs/docs/System.Posix.File.Stats.html @@ -61,4 +61,4 @@ -

    System.Posix.File.Stats

    (source)

    Definitions

    recordStatvfs : Type
    Totality: total
    Visibility: export
    Constructor: 
    SF : AnyPtr->Statvfs

    Projection: 
    .ptr : Statvfs->AnyPtr

    Hints:
    SizeOfStatvfs
    StructStatvfs
    blockSize : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    fundamentalBlockSize : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    blocks : HasIOio=>Statvfs->ioFsBlkCntT
    Totality: total
    Visibility: export
    freeBlocks : HasIOio=>Statvfs->ioFsBlkCntT
    Totality: total
    Visibility: export
    availableBlocks : HasIOio=>Statvfs->ioFsBlkCntT
    Totality: total
    Visibility: export
    files : HasIOio=>Statvfs->ioFsFilCntT
    Totality: total
    Visibility: export
    freeFiles : HasIOio=>Statvfs->ioFsFilCntT
    Totality: total
    Visibility: export
    availableFiles : HasIOio=>Statvfs->ioFsFilCntT
    Totality: total
    Visibility: export
    fsID : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    flags : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    namemax : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    recordFileStats : Type
    Totality: total
    Visibility: export
    Constructor: 
    FS : AnyPtr->FileStats

    Projection: 
    .ptr : FileStats->AnyPtr

    Hints:
    SizeOfFileStats
    StructFileStats
    dev : HasIOio=>FileStats->ioDevT
    Totality: total
    Visibility: export
    ino : HasIOio=>FileStats->ioInoT
    Totality: total
    Visibility: export
    mode : HasIOio=>FileStats->ioModeT
    Totality: total
    Visibility: export
    Totality: total
    Visibility: export
    uid : HasIOio=>FileStats->ioUidT
    Totality: total
    Visibility: export
    gid : HasIOio=>FileStats->ioGidT
    Totality: total
    Visibility: export
    rdev : HasIOio=>FileStats->ioDevT
    Totality: total
    Visibility: export
    size : HasIOio=>FileStats->ioSizeT
    Totality: total
    Visibility: export
    blksize : HasIOio=>FileStats->ioBlkSizeT
    Totality: total
    Visibility: export
    blocks : HasIOio=>FileStats->ioBlkCntT
    Totality: total
    Visibility: export
    atime : HasIOio=>FileStats->ioAnyPtr
    Totality: total
    Visibility: export
    mtime : HasIOio=>FileStats->ioAnyPtr
    Totality: total
    Visibility: export
    ctime : HasIOio=>FileStats->ioAnyPtr
    Totality: total
    Visibility: export
    statvfs : String->Statvfs->IO (EitherErrno ())
    Totality: total
    Visibility: export
    fstatvfs : FileDesca=>a->Statvfs->IO (EitherErrno ())
    Totality: total
    Visibility: export
    stat : String->FileStats->IO (EitherErrno ())
    Totality: total
    Visibility: export
    lstat : String->FileStats->IO (EitherErrno ())
    Totality: total
    Visibility: export
    fstat : FileDesca=>a->FileStats->IO (EitherErrno ())
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.File.Stats

    (source)

    Definitions

    recordStatvfs : Type
    Totality: total
    Visibility: export
    Constructor: 
    SF : AnyPtr->Statvfs

    Projection: 
    .ptr : Statvfs->AnyPtr

    Hints:
    SizeOfStatvfs
    StructStatvfs
    blockSize : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    fundamentalBlockSize : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    blocks : HasIOio=>Statvfs->ioFsBlkCntT
    Totality: total
    Visibility: export
    freeBlocks : HasIOio=>Statvfs->ioFsBlkCntT
    Totality: total
    Visibility: export
    availableBlocks : HasIOio=>Statvfs->ioFsBlkCntT
    Totality: total
    Visibility: export
    files : HasIOio=>Statvfs->ioFsFilCntT
    Totality: total
    Visibility: export
    freeFiles : HasIOio=>Statvfs->ioFsFilCntT
    Totality: total
    Visibility: export
    availableFiles : HasIOio=>Statvfs->ioFsFilCntT
    Totality: total
    Visibility: export
    fsID : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    flags : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    namemax : HasIOio=>Statvfs->ioULong
    Totality: total
    Visibility: export
    recordFileStats : Type
    Totality: total
    Visibility: export
    Constructor: 
    FS : AnyPtr->FileStats

    Projection: 
    .ptr : FileStats->AnyPtr

    Hints:
    SizeOfFileStats
    StructFileStats
    dev : HasIOio=>FileStats->ioDevT
    Totality: total
    Visibility: export
    ino : HasIOio=>FileStats->ioInoT
    Totality: total
    Visibility: export
    mode : HasIOio=>FileStats->ioModeT
    Totality: total
    Visibility: export
    Totality: total
    Visibility: export
    uid : HasIOio=>FileStats->ioUidT
    Totality: total
    Visibility: export
    gid : HasIOio=>FileStats->ioGidT
    Totality: total
    Visibility: export
    rdev : HasIOio=>FileStats->ioDevT
    Totality: total
    Visibility: export
    size : HasIOio=>FileStats->ioSizeT
    Totality: total
    Visibility: export
    blksize : HasIOio=>FileStats->ioBlkSizeT
    Totality: total
    Visibility: export
    blocks : HasIOio=>FileStats->ioBlkCntT
    Totality: total
    Visibility: export
    atime : HasIOio=>FileStats->ioAnyPtr
    Totality: total
    Visibility: export
    mtime : HasIOio=>FileStats->ioAnyPtr
    Totality: total
    Visibility: export
    ctime : HasIOio=>FileStats->ioAnyPtr
    Totality: total
    Visibility: export
    statvfs : ErrIOio=>String->Statvfs->io ()
    Totality: total
    Visibility: export
    fstatvfs : ErrIOio=>FileDesca=>a->Statvfs->io ()
    Totality: total
    Visibility: export
    stat : ErrIOio=>String->FileStats->io ()
    Totality: total
    Visibility: export
    lstat : ErrIOio=>String->FileStats->io ()
    Totality: total
    Visibility: export
    fstat : ErrIOio=>FileDesca=>a->FileStats->io ()
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.File.Stats.src.html b/docs/posix/docs/docs/System.Posix.File.Stats.src.html index d52e3cc15..b30d6df92 100644 --- a/docs/posix/docs/docs/System.Posix.File.Stats.src.html +++ b/docs/posix/docs/docs/System.Posix.File.Stats.src.html @@ -359,23 +359,23 @@
    238 | --------------------------------------------------------------------------------
    240 | export %inline
    -
    241 | statvfs : String -> Statvfs -> IO (Either Errno ())
    +
    241 | statvfs : ErrIO io => String -> Statvfs -> io ()
    242 | statvfs s p = toUnit $ prim__statvfs s p.ptr
    244 | export %inline
    -
    245 | fstatvfs : FileDesc a => a -> Statvfs -> IO (Either Errno ())
    +
    245 | fstatvfs : ErrIO io => FileDesc a => a -> Statvfs -> io ()
    246 | fstatvfs fd p = toUnit $ prim__fstatvfs (fileDesc fd) p.ptr
    248 | export %inline
    -
    249 | stat : String -> FileStats -> IO (Either Errno ())
    +
    249 | stat : ErrIO io => String -> FileStats -> io ()
    250 | stat s p = toUnit $ prim__stat s p.ptr
    252 | export %inline
    -
    253 | lstat : String -> FileStats -> IO (Either Errno ())
    +
    253 | lstat : ErrIO io => String -> FileStats -> io ()
    254 | lstat s p = toUnit $ prim__lstat s p.ptr
    256 | export
    -
    257 | fstat : FileDesc a => a -> FileStats -> IO (Either Errno ())
    +
    257 | fstat : ErrIO io => FileDesc a => a -> FileStats -> io ()
    258 | fstat fd p = toUnit $ prim__fstat (fileDesc fd) p.ptr
    diff --git a/docs/posix/docs/docs/System.Posix.File.Type.html b/docs/posix/docs/docs/System.Posix.File.Type.html index 15df749c3..2a6b48ac6 100644 --- a/docs/posix/docs/docs/System.Posix.File.Type.html +++ b/docs/posix/docs/docs/System.Posix.File.Type.html @@ -61,4 +61,4 @@ -

    System.Posix.File.Type

    (source)

    Definitions

    dataFileType : Type
    Totality: total
    Visibility: public export
    Constructors:
    Regular : FileType
    Directory : FileType
    CharDevice : FileType
    BlockDevice : FileType
    Pipe : FileType
    Socket : FileType
    Other : FileType

    Hints:
    EqFileType
    FiniteFileType
    OrdFileType
    ShowFileType
    fromMode : ModeT->FileType
    Totality: total
    Visibility: public export
    statvfs_size : Nat
    Totality: total
    Visibility: public export
    stat_size : Nat
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.File.Type

    (source)

    Definitions

    dataFileType : Type
    Totality: total
    Visibility: public export
    Constructors:
    Regular : FileType
    Directory : FileType
    CharDevice : FileType
    BlockDevice : FileType
    Pipe : FileType
    Socket : FileType
    Other : FileType

    Hints:
    EqFileType
    FiniteFileType
    OrdFileType
    ShowFileType
    fromMode : ModeT->FileType
    Totality: total
    Visibility: public export
    statvfs_size : Nat
    Totality: total
    Visibility: public export
    stat_size : Nat
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.File.Whence.html b/docs/posix/docs/docs/System.Posix.File.Whence.html index 251c8cce5..a04259b7d 100644 --- a/docs/posix/docs/docs/System.Posix.File.Whence.html +++ b/docs/posix/docs/docs/System.Posix.File.Whence.html @@ -61,4 +61,4 @@ -

    System.Posix.File.Whence

    (source)

    Definitions

    dataWhence : Type
    Totality: total
    Visibility: public export
    Constructors:
    SEEK_SET : Whence
    SEEK_CUR : Whence
    SEEK_END : Whence

    Hints:
    EqWhence
    FiniteWhence
    OrdWhence
    ShowWhence
    whenceCode : Whence->Bits8
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.File.Whence

    (source)

    Definitions

    dataWhence : Type
    Totality: total
    Visibility: public export
    Constructors:
    SEEK_SET : Whence
    SEEK_CUR : Whence
    SEEK_END : Whence

    Hints:
    EqWhence
    FiniteWhence
    OrdWhence
    ShowWhence
    whenceCode : Whence->Bits8
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.File.html b/docs/posix/docs/docs/System.Posix.File.html index 69850c20d..3ff6dd2c9 100644 --- a/docs/posix/docs/docs/System.Posix.File.html +++ b/docs/posix/docs/docs/System.Posix.File.html @@ -61,4 +61,4 @@ -

    System.Posix.File

    (source)

    Reexports

    importpublic Data.Buffer
    importpublic Data.Buffer.Core
    importpublic Data.ByteString
    importpublic Data.ByteVect
    importpublic Data.C.Integer
    importpublic System.Posix.Errno
    importpublic System.Posix.File.Flags
    importpublic System.Posix.File.Whence

    Definitions

    recordFd : Type
      A wrapper around a file descriptor.

    Totality: total
    Visibility: public export
    Constructor: 
    MkFd : Bits32->Fd

    Projection: 
    .fd : Fd->Bits32

    Hints:
    CastBits32Fd
    CastStdIOFd
    EqFd
    OrdFd
    ShowFd
    .fd : Fd->Bits32
    Totality: total
    Visibility: public export
    fd : Fd->Bits32
    Totality: total
    Visibility: public export
    0FileDesc : Type->Type
    Totality: total
    Visibility: public export
    fileDesc : FileDesca=>a->Bits32
    Totality: total
    Visibility: export
    dataStdIO : Type
      Standard input and output file descriptors

    Totality: total
    Visibility: public export
    Constructors:
    Stdin : StdIO
    Stdout : StdIO
    Stderr : StdIO

    Hints:
    CastStdIOFd
    EqStdIO
    OrdStdIO
    ShowStdIO
    recordMode : Type
      File permissions.

    Totality: total
    Visibility: public export
    Constructor: 
    M : ModeT->Mode

    Projection: 
    .mode : Mode->ModeT

    Hints:
    EqMode
    MonoidMode
    OrdMode
    SemigroupMode
    ShowMode
    .mode : Mode->ModeT
    Totality: total
    Visibility: public export
    mode : Mode->ModeT
    Totality: total
    Visibility: public export
    toBytes : Bits32-> (Buffer->Bits32->PrimIOSsizeT) ->IO (EitherErrnoByteString)
      Converts a number of bytes read into a buffer to a `ByteString`

    Totality: total
    Visibility: export
    toFD : PrimIOCInt->IO (EitherErrnoFd)
    Totality: total
    Visibility: export
    openFile : String->Flags->Mode->IO (EitherErrnoFd)
      Tries to open a file with the given flags and mode.

    Totality: total
    Visibility: export
    close : FileDesca=>a->IO (EitherErrno ())
      Closes a file descriptor.

    Totality: total
    Visibility: export
    readPtr : FileDesca=>a->AnyPtr->Bits32->IO (EitherErrnoBits32)
      Reads at most `n` bytes from a file into an allocated pointer.

    Totality: total
    Visibility: export
    readRaw : FileDesca=>a->Buffer->Bits32->IO (EitherErrnoBits32)
      Reads at most `n` bytes from a file into a buffer.

    Totality: total
    Visibility: export
    read : FileDesca=>a->Bits32->IO (EitherErrnoByteString)
      Reads at most `n` bytes from a file into a bytestring.

    Totality: total
    Visibility: export
    pread : FileDesca=>a->Bits32->OffT->IO (EitherErrnoByteString)
      Atomically reads up to `n` bytes from the given file at
    the given file offset.

    Notes: This will only work with seekable files but not with
    arbitrary data streams such as pipes or sockets.
    Also, it will not change the position of the open file description.

    Totality: total
    Visibility: export
    writeBytes : FileDesca=>a->ByteString->IO (EitherErrnoBits32)
      Writes up to the number of bytes in the bytestring
    to the given file.

    Note: This is an atomic operation if `fd` is a regular file that
    was opened in "append" mode (with the `O_APPEND` flag).

    Totality: total
    Visibility: export
    writeRaw : FileDesca=>a->Buffer->Bits32->Bits32->IO (EitherErrnoBits32)
      Reads at most `n` bytes from a file into a bytestring.

    Totality: total
    Visibility: export
    pwriteBytes : FileDesca=>a->ByteString->OffT->IO (EitherErrnoBits32)
      Atomically writes up to the number of bytes in the bytestring
    to the given file at the given file offset.

    Notes: This will only work with seekable files but not with
    arbitrary data streams such as pipes or sockets.
    Also, it will not change the position of the open file description.

    Totality: total
    Visibility: export
    write : FileDesca=>a->IBuffern->IO (EitherErrnoBits32)
    Totality: total
    Visibility: export
    writeStr : FileDesca=>a->String->IO (EitherErrnoBits32)
    Totality: total
    Visibility: export
    writeStrLn : FileDesca=>a->String->IO (EitherErrnoBits32)
    Totality: total
    Visibility: export
    lseek : FileDesca=>a->HasIOio=>OffT->Whence->ioOffT
      Moves the file pointer to the given offset relative to the
    `Whence` value.

    Totality: total
    Visibility: export
    dup : FileDesca=>a->IO (EitherErrnoFd)
      Duplicates the given open file descriptor.

    The duplicate is guaranteed to be given the smallest available
    file descriptor.

    Totality: total
    Visibility: export
    dup2 : FileDesca=>a->FileDescb=>b->IO (EitherErrnoFd)
      Duplicates the given open file descriptor.

    The new file descriptor vill have the integer value of `fd2`.
    This is an atomic operation that will close `fd2` if it is still open.

    Totality: total
    Visibility: export
    dupfd : FileDesca=>a->Bits32->IO (EitherErrnoFd)
      Duplicates the given open file descriptor.

    The new file descriptor vill have the integer value of `fd2`.
    This is an atomic operation that will close `fd2` if it is still open.

    Totality: total
    Visibility: export
    getFlags : FileDesca=>a->IO (EitherErrnoFlags)
      Gets the flags set at an open file descriptor.

    Totality: total
    Visibility: export
    setFlags : FileDesca=>a->Flags->IO (EitherErrno ())
      Sets the flags of an open file descriptor.

    Note: This replaces the currently set flags. See also `addFlags`.

    Totality: total
    Visibility: export
    addFlags : FileDesca=>a->Flags->IO (EitherErrno ())
      Adds the given flags to the flags set for an open
    file descriptor by ORing them with the currently set flags.

    Totality: total
    Visibility: export
    ftruncate : FileDesca=>a->OffT->IO (EitherErrno ())
      Truncates a file to the given length.

    Totality: total
    Visibility: export
    truncate : String->OffT->IO (EitherErrno ())
      Truncates a file to the given length.

    Totality: total
    Visibility: export
    mkstemp : String->IO (EitherErrno (Fd, String))
      Atomically creates and opens a temporary, unique file.

    Totality: total
    Visibility: export
      Creates a (hard) link to a file.

    Totality: total
    Visibility: export
      Creates a (hard) link to a file.

    Totality: total
    Visibility: export
      Deletes a (hard) link to a file.

    If this is the last link to the file, the file is removed.

    Note: Files with open file descriptors will only be deleted after the last
    open file descriptor is closed, but the file name will already
    disapper from the file system before that.

    Totality: total
    Visibility: export
    remove : String->IO (EitherErrno ())
      Removes a file or (empty) directory calling `unlink` or `rmdir`
    internally.

    Totality: total
    Visibility: export
    rename : String->String->IO (EitherErrno ())
      Renames a file within a file system.

    Note: This will fail if the two paths point to different file systems.
    In that case, the file needs to be copied from one FS to the other.

    Totality: total
    Visibility: export
      Returns the path of a file a symbolic link points to

    This allocates a buffer of 4096 bytes for the byte array holding
    the result.

    Totality: total
    Visibility: export
    stdout : HasIOio=>String->io ()
    Totality: total
    Visibility: export
    stdoutLn : HasIOio=>String->io ()
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.File

    (source)

    Reexports

    importpublic Data.Buffer
    importpublic Data.Buffer.Core
    importpublic Data.ByteString
    importpublic Data.ByteVect
    importpublic Data.C.Ptr
    importpublic System.Posix.Errno
    importpublic System.Posix.File.Flags
    importpublic System.Posix.File.Whence

    Definitions

    recordFd : Type
      A wrapper around a file descriptor.

    Totality: total
    Visibility: public export
    Constructor: 
    MkFd : Bits32->Fd

    Projection: 
    .fd : Fd->Bits32

    Hints:
    CastBits32Fd
    CastStdIOFd
    DerefFd
    EqFd
    OrdFd
    SetPtrFd
    ShowFd
    SizeOfFd
    .fd : Fd->Bits32
    Totality: total
    Visibility: public export
    fd : Fd->Bits32
    Totality: total
    Visibility: public export
    0FileDesc : Type->Type
    Totality: total
    Visibility: public export
    fileDesc : FileDesca=>a->Bits32
    Totality: total
    Visibility: export
    dataStdIO : Type
      Standard input and output file descriptors

    Totality: total
    Visibility: public export
    Constructors:
    Stdin : StdIO
    Stdout : StdIO
    Stderr : StdIO

    Hints:
    CastStdIOFd
    EqStdIO
    OrdStdIO
    ShowStdIO
    recordMode : Type
      File permissions.

    Totality: total
    Visibility: public export
    Constructor: 
    M : ModeT->Mode

    Projection: 
    .mode : Mode->ModeT

    Hints:
    EqMode
    MonoidMode
    OrdMode
    SemigroupMode
    ShowMode
    .mode : Mode->ModeT
    Totality: total
    Visibility: public export
    mode : Mode->ModeT
    Totality: total
    Visibility: public export
    toBytes : ErrIOio=>Bits32-> (Buffer->Bits32->PrimIOSsizeT) ->ioByteString
      Converts a number of bytes read into a buffer to a `ByteString`

    Totality: total
    Visibility: export
    toFD : ErrIOio=>PrimIOCInt->ioFd
    Totality: total
    Visibility: export
    openFile : ErrIOio=>String->Flags->Mode->ioFd
      Tries to open a file with the given flags and mode.

    Totality: total
    Visibility: export
    close : FileDesca=>ErrIOio=>a->io ()
      Closes a file descriptor.

    Totality: total
    Visibility: export
    readPtr : FileDesca=>ErrIOio=>a->AnyPtr->Bits32->ioBits32
      Reads at most `n` bytes from a file into an allocated pointer.

    Totality: total
    Visibility: export
    readArr : FileDesca=>ErrIOio=>a->SizeOfb=>CArrayIOnb->ioBits32
      Reads at most `n * sizeof a` bytes into a preallocated array.

    Totality: total
    Visibility: export
    readRaw : FileDesca=>ErrIOio=>a->Buffer->Bits32->ioBits32
      Reads at most `n` bytes from a file into a buffer.

    Totality: total
    Visibility: export
    read : FileDesca=>ErrIOio=>a->Bits32->ioByteString
      Reads at most `n` bytes from a file into a bytestring.

    Totality: total
    Visibility: export
    pread : FileDesca=>ErrIOio=>a->Bits32->OffT->ioByteString
      Atomically reads up to `n` bytes from the given file at
    the given file offset.

    Notes: This will only work with seekable files but not with
    arbitrary data streams such as pipes or sockets.
    Also, it will not change the position of the open file description.

    Totality: total
    Visibility: export
    writeBytes : FileDesca=>ErrIOio=>a->ByteString->ioBits32
      Writes up to the number of bytes in the bytestring
    to the given file.

    Note: This is an atomic operation if `fd` is a regular file that
    was opened in "append" mode (with the `O_APPEND` flag).

    Totality: total
    Visibility: export
    writeRaw : FileDesca=>ErrIOio=>a->Buffer->Bits32->Bits32->ioBits32
      Writes up to the given number of bytes from the given buffer starting
    at the given offset.

    Note: This is an atomic operation if `fd` is a regular file that
    was opened in "append" mode (with the `O_APPEND` flag).

    Totality: total
    Visibility: export
    writePtr : FileDesca=>ErrIOio=>a->AnyPtr->Bits32->ioBits32
      Writes up to the number of bytes from the given C ptr.

    Note: This is an atomic operation if `fd` is a regular file that
    was opened in "append" mode (with the `O_APPEND` flag).

    Totality: total
    Visibility: export
    writeArr : FileDesca=>ErrIOio=>a->SizeOfb=>CArrayIOnb->ioBits32
      Writes the content of the given array.

    Note: This is an atomic operation if `fd` is a regular file that
    was opened in "append" mode (with the `O_APPEND` flag).

    Totality: total
    Visibility: export
    pwriteBytes : FileDesca=>ErrIOio=>a->ByteString->OffT->ioBits32
      Atomically writes up to the number of bytes in the bytestring
    to the given file at the given file offset.

    Notes: This will only work with seekable files but not with
    arbitrary data streams such as pipes or sockets.
    Also, it will not change the position of the open file description.

    Totality: total
    Visibility: export
    write : FileDesca=>ErrIOio=>a->IBuffern->ioBits32
    Totality: total
    Visibility: export
    writeStr : FileDesca=>ErrIOio=>a->String->ioBits32
    Totality: total
    Visibility: export
    writeStrLn : FileDesca=>ErrIOio=>a->String->ioBits32
    Totality: total
    Visibility: export
    lseek : FileDesca=>ErrIOio=>a->HasIOio=>OffT->Whence->ioOffT
      Moves the file pointer to the given offset relative to the
    `Whence` value.

    Totality: total
    Visibility: export
    dup : FileDesca=>ErrIOio=>a->ioFd
      Duplicates the given open file descriptor.

    The duplicate is guaranteed to be given the smallest available
    file descriptor.

    Totality: total
    Visibility: export
    dup2 : FileDesca=>ErrIOio=>a->FileDescb=>b->ioFd
      Duplicates the given open file descriptor.

    The new file descriptor vill have the integer value of `fd2`.
    This is an atomic operation that will close `fd2` if it is still open.

    Totality: total
    Visibility: export
    dupfd : FileDesca=>ErrIOio=>a->Bits32->ioFd
      Duplicates the given open file descriptor.

    The new file descriptor vill have the integer value of `fd2`.
    This is an atomic operation that will close `fd2` if it is still open.

    Totality: total
    Visibility: export
    getFlags : FileDesca=>ErrIOio=>a->ioFlags
      Gets the flags set at an open file descriptor.

    Totality: total
    Visibility: export
    setFlags : FileDesca=>ErrIOio=>a->Flags->io ()
      Sets the flags of an open file descriptor.

    Note: This replaces the currently set flags. See also `addFlags`.

    Totality: total
    Visibility: export
    addFlags : FileDesca=>ErrIOio=>a->Flags->io ()
      Adds the given flags to the flags set for an open
    file descriptor by ORing them with the currently set flags.

    Totality: total
    Visibility: export
    ftruncate : FileDesca=>ErrIOio=>a->OffT->io ()
      Truncates a file to the given length.

    Totality: total
    Visibility: export
    truncate : ErrIOio=>String->OffT->io ()
      Truncates a file to the given length.

    Totality: total
    Visibility: export
    mkstemp : ErrIOio=>String->io (Fd, String)
      Atomically creates and opens a temporary, unique file.

    Totality: total
    Visibility: export
      Creates a (hard) link to a file.

    Totality: total
    Visibility: export
      Creates a (hard) link to a file.

    Totality: total
    Visibility: export
      Deletes a (hard) link to a file.

    If this is the last link to the file, the file is removed.

    Note: Files with open file descriptors will only be deleted after the last
    open file descriptor is closed, but the file name will already
    disapper from the file system before that.

    Totality: total
    Visibility: export
    remove : ErrIOio=>String->io ()
      Removes a file or (empty) directory calling `unlink` or `rmdir`
    internally.

    Totality: total
    Visibility: export
    rename : ErrIOio=>String->String->io ()
      Renames a file within a file system.

    Note: This will fail if the two paths point to different file systems.
    In that case, the file needs to be copied from one FS to the other.

    Totality: total
    Visibility: export
      Returns the path of a file a symbolic link points to

    This allocates a buffer of 4096 bytes for the byte array holding
    the result.

    Totality: total
    Visibility: export
    stdout : ErrIOio=>String->io ()
    Totality: total
    Visibility: export
    stdoutLn : ErrIOio=>String->io ()
    Totality: total
    Visibility: export
    prnt : ErrIOio=>Showa=>a->io ()
    Totality: total
    Visibility: export
    prntLn : ErrIOio=>Showa=>a->io ()
    Totality: total
    Visibility: export
    stderr : ErrIOio=>String->io ()
    Totality: total
    Visibility: export
    stderrLn : ErrIOio=>String->io ()
    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.File.src.html b/docs/posix/docs/docs/System.Posix.File.src.html index 1e96f160a..77bb7cd01 100644 --- a/docs/posix/docs/docs/System.Posix.File.src.html +++ b/docs/posix/docs/docs/System.Posix.File.src.html @@ -129,7 +129,7 @@
      8 | import public Data.ByteString
      9 | import public Data.ByteVect
    -
     11 | import public Data.C.Integer
    +
     11 | import public Data.C.Ptr
     13 | import public System.Posix.Errno
     14 | import public System.Posix.File.Flags
    @@ -144,7 +144,7 @@
     23 | --------------------------------------------------------------------------------
     25 | %foreign "C:li_open, posix-idris"
    -
     26 | prim__open : String -> CInt -> ModeT -> PrimIO CInt
    +
     26 | prim__open : String -> Bits32 -> ModeT -> PrimIO CInt
     28 | %foreign "C:li_close, posix-idris"
     29 | prim__close : Bits32 -> PrimIO CInt
    @@ -161,365 +161,414 @@
     40 | %foreign "C:li_write, posix-idris"
     41 | prim__write : (file : Bits32) -> Buffer -> (off,max : Bits32) -> PrimIO SsizeT
    -
     43 | %foreign "C:li_pwrite, posix-idris"
    -
     44 | prim__pwrite : (file : Bits32) -> Buffer -> (off,max : Bits32) -> OffT -> PrimIO SsizeT
    +
     43 | %foreign "C:li_write, posix-idris"
    +
     44 | prim__writeptr : (file : Bits32) -> AnyPtr -> (off,max : Bits32) -> PrimIO SsizeT
    -
     46 | %foreign "C:lseek, posix-idris"
    -
     47 | prim__lseek : (file : Bits32) -> (off : OffT) -> (whence : CInt) -> PrimIO OffT
    +
     46 | %foreign "C:li_pwrite, posix-idris"
    +
     47 | prim__pwrite : (file : Bits32) -> Buffer -> (off,max : Bits32) -> OffT -> PrimIO SsizeT
    -
     49 | %foreign "C:li_set_flags, posix-idris"
    -
     50 | prim__setFlags : (file : Bits32) -> (flags : CInt) -> PrimIO CInt
    +
     49 | %foreign "C:lseek, posix-idris"
    +
     50 | prim__lseek : (file : Bits32) -> (off : OffT) -> (whence : CInt) -> PrimIO OffT
    -
     52 | %foreign "C:li_get_flags, posix-idris"
    -
     53 | prim__getFlags : (file : Bits32) -> PrimIO CInt
    +
     52 | %foreign "C:li_set_flags, posix-idris"
    +
     53 | prim__setFlags : (file : Bits32) -> (flags : Bits32) -> PrimIO CInt
    -
     55 | %foreign "C:li_dup, posix-idris"
    -
     56 | prim__dup : (file : Bits32) -> PrimIO CInt
    +
     55 | %foreign "C:li_get_flags, posix-idris"
    +
     56 | prim__getFlags : (file : Bits32) -> PrimIO CInt
    -
     58 | %foreign "C:li_dup2, posix-idris"
    -
     59 | prim__dup2 : (file, dst : Bits32) -> PrimIO CInt
    +
     58 | %foreign "C:li_dup, posix-idris"
    +
     59 | prim__dup : (file : Bits32) -> PrimIO CInt
    -
     61 | %foreign "C:li_dupfd, posix-idris"
    -
     62 | prim__dupfd : (file, startfd : Bits32) -> PrimIO CInt
    +
     61 | %foreign "C:li_dup2, posix-idris"
    +
     62 | prim__dup2 : (file, dst : Bits32) -> PrimIO CInt
    -
     64 | %foreign "C:li_ftruncate, posix-idris"
    -
     65 | prim__ftruncate : (file : Bits32) -> (len : OffT) -> PrimIO CInt
    +
     64 | %foreign "C:li_dupfd, posix-idris"
    +
     65 | prim__dupfd : (file, startfd : Bits32) -> PrimIO CInt
    -
     67 | %foreign "C:li_truncate, posix-idris"
    -
     68 | prim__truncate : (file : String) -> (len : OffT) -> PrimIO CInt
    +
     67 | %foreign "C:li_ftruncate, posix-idris"
    +
     68 | prim__ftruncate : (file : Bits32) -> (len : OffT) -> PrimIO CInt
    -
     70 | %foreign "C:li_mkstemp, posix-idris"
    -
     71 | prim__mkstemp : Buffer -> PrimIO CInt
    +
     70 | %foreign "C:li_truncate, posix-idris"
    +
     71 | prim__truncate : (file : String) -> (len : OffT) -> PrimIO CInt
    -
     73 | %foreign "C:li_link, posix-idris"
    -
     74 | prim__link : String -> String -> PrimIO CInt
    +
     73 | %foreign "C:li_mkstemp, posix-idris"
    +
     74 | prim__mkstemp : Buffer -> PrimIO CInt
    -
     76 | %foreign "C:li_symlink, posix-idris"
    -
     77 | prim__symlink : String -> String -> PrimIO CInt
    +
     76 | %foreign "C:li_link, posix-idris"
    +
     77 | prim__link : String -> String -> PrimIO CInt
    -
     79 | %foreign "C:li_rename, posix-idris"
    -
     80 | prim__rename : String -> String -> PrimIO CInt
    +
     79 | %foreign "C:li_symlink, posix-idris"
    +
     80 | prim__symlink : String -> String -> PrimIO CInt
    -
     82 | %foreign "C:li_unlink, posix-idris"
    -
     83 | prim__unlink : String -> PrimIO CInt
    +
     82 | %foreign "C:li_rename, posix-idris"
    +
     83 | prim__rename : String -> String -> PrimIO CInt
    -
     85 | %foreign "C:li_remove, posix-idris"
    -
     86 | prim__remove : String -> PrimIO CInt
    +
     85 | %foreign "C:li_unlink, posix-idris"
    +
     86 | prim__unlink : String -> PrimIO CInt
    -
     88 | %foreign "C:li_readlink, posix-idris"
    -
     89 | prim__readlink : (file : String) -> Buffer -> (max : Bits32) -> PrimIO SsizeT
    +
     88 | %foreign "C:li_remove, posix-idris"
    +
     89 | prim__remove : String -> PrimIO CInt
    -
     91 | --------------------------------------------------------------------------------
    -
     92 | -- FileDesc
    -
     93 | --------------------------------------------------------------------------------
    - -
     95 | ||| A wrapper around a file descriptor.
    -
     96 | public export
    -
     97 | record Fd where
    -
     98 |   constructor MkFd
    -
     99 |   fd : Bits32
    - -
    101 | %name Fd fd
    - -
    103 | %runElab derive "Fd" [Show,Eq,Ord]
    - -
    105 | public export
    -
    106 | 0 FileDesc : Type -> Type
    -
    107 | FileDesc a = Cast a Fd
    - -
    109 | export %inline
    -
    110 | Cast Bits32 Fd where cast = MkFd
    +
     91 | %foreign "C:li_readlink, posix-idris"
    +
     92 | prim__readlink : (file : String) -> Buffer -> (max : Bits32) -> PrimIO SsizeT
    + +
     94 | --------------------------------------------------------------------------------
    +
     95 | -- FileDesc
    +
     96 | --------------------------------------------------------------------------------
    + +
     98 | ||| A wrapper around a file descriptor.
    +
     99 | public export
    +
    100 | record Fd where
    +
    101 |   constructor MkFd
    +
    102 |   fd : Bits32
    + +
    104 | %name Fd fd
    + +
    106 | %runElab derive "Fd" [Show,Eq,Ord]
    + +
    108 | public export
    +
    109 | 0 FileDesc : Type -> Type
    +
    110 | FileDesc a = Cast a Fd
    112 | export %inline
    -
    113 | fileDesc : FileDesc a => a -> Bits32
    -
    114 | fileDesc = fd . cast
    - -
    116 | ||| Standard input and output file descriptors
    -
    117 | public export
    -
    118 | data StdIO : Type where
    -
    119 |   Stdin  : StdIO
    -
    120 |   Stdout : StdIO
    -
    121 |   Stderr : StdIO
    +
    113 | Cast Bits32 Fd where cast = MkFd
    + +
    115 | export %inline
    +
    116 | fileDesc : FileDesc a => a -> Bits32
    +
    117 | fileDesc = fd . cast
    + +
    119 | public export %inline
    +
    120 | SizeOf Fd where
    +
    121 |   sizeof_ = sizeof Bits32
    -
    123 | %runElab derive "StdIO" [Show,Eq,Ord]
    - -
    125 | export %inline
    -
    126 | Cast StdIO Fd where
    -
    127 |   cast = MkFd . cast . conIndexStdIO
    - -
    129 | --------------------------------------------------------------------------------
    -
    130 | -- Mode
    -
    131 | --------------------------------------------------------------------------------
    - -
    133 | ||| File permissions.
    -
    134 | public export
    -
    135 | record Mode where
    -
    136 |   constructor M
    -
    137 |   mode : ModeT
    - -
    139 | %runElab derive "Mode" [Show,Eq,Ord,FromInteger]
    - -
    141 | public export
    -
    142 | Semigroup Mode where
    -
    143 |   M x <+> M y = M $ x .|. y
    - -
    145 | public export
    -
    146 | Monoid Mode where neutral = M 0
    +
    123 | export %inline
    +
    124 | Deref Fd where
    +
    125 |   deref p = MkFd <$> deref p
    + +
    127 | export %inline
    +
    128 | SetPtr Fd where
    +
    129 |   setPtr p = setPtr p . fd
    + +
    131 | ||| Standard input and output file descriptors
    +
    132 | public export
    +
    133 | data StdIO : Type where
    +
    134 |   Stdin  : StdIO
    +
    135 |   Stdout : StdIO
    +
    136 |   Stderr : StdIO
    + +
    138 | %runElab derive "StdIO" [Show,Eq,Ord]
    + +
    140 | export %inline
    +
    141 | Cast StdIO Fd where
    +
    142 |   cast = MkFd . cast . conIndexStdIO
    + +
    144 | --------------------------------------------------------------------------------
    +
    145 | -- Mode
    +
    146 | --------------------------------------------------------------------------------
    -
    148 | --------------------------------------------------------------------------------
    -
    149 | -- Utilities
    -
    150 | --------------------------------------------------------------------------------
    - -
    152 | ||| Converts a number of bytes read into a buffer to a `ByteString`
    -
    153 | export %inline
    -
    154 | toBytes :
    -
    155 |      Bits32
    -
    156 |   -> (Buffer -> Bits32 -> PrimIO SsizeT)
    -
    157 |   -> IO (Either Errno ByteString)
    -
    158 | toBytes n act =
    -
    159 |   fromPrim $ \w =>
    -
    160 |     let MkIORes buf w := prim__newBuf n w
    -
    161 |         MkIORes rd  w := act buf n w
    -
    162 |      in case rd < 0 of
    -
    163 |           False => MkIORes (Right $ unsafeByteString (cast rd) buf) w
    -
    164 |           True  => MkIORes (Left $ fromNeg rd) w
    - -
    166 | export %inline
    -
    167 | toFD : PrimIO CInt -> IO (Either Errno Fd)
    -
    168 | toFD = toVal (MkFd . cast)
    - -
    170 | --------------------------------------------------------------------------------
    -
    171 | -- File Operations
    -
    172 | --------------------------------------------------------------------------------
    - -
    174 | ||| Tries to open a file with the given flags and mode.
    -
    175 | export %inline
    -
    176 | openFile : String -> Flags -> Mode -> IO (Either Errno Fd)
    -
    177 | openFile p (F f) (M m) = toFD (prim__open p f m)
    +
    148 | ||| File permissions.
    +
    149 | public export
    +
    150 | record Mode where
    +
    151 |   constructor M
    +
    152 |   mode : ModeT
    + +
    154 | %runElab derive "Mode" [Show,Eq,Ord,FromInteger]
    + +
    156 | public export
    +
    157 | Semigroup Mode where
    +
    158 |   M x <+> M y = M $ x .|. y
    + +
    160 | public export
    +
    161 | Monoid Mode where neutral = M 0
    + +
    163 | --------------------------------------------------------------------------------
    +
    164 | -- Utilities
    +
    165 | --------------------------------------------------------------------------------
    + +
    167 | ||| Converts a number of bytes read into a buffer to a `ByteString`
    +
    168 | export %inline
    +
    169 | toBytes :
    +
    170 |      {auto has : ErrIO io}
    +
    171 |   -> Bits32
    +
    172 |   -> (Buffer -> Bits32 -> PrimIO SsizeT)
    +
    173 |   -> io ByteString
    +
    174 | toBytes n act = do
    +
    175 |   buf <- primIO $ prim__newBuf n
    +
    176 |   rd  <- primIO $ act buf n
    +
    177 |   if rd < 0 then error (fromNeg rd) else pure (unsafeByteString (cast rd) buf)
    -
    179 | parameters {auto fid : FileDesc a}
    -
    180 |            (fd       : a)
    - -
    182 |   ||| Closes a file descriptor.
    -
    183 |   export %inline
    -
    184 |   close : IO (Either Errno ())
    -
    185 |   close = toUnit (prim__close $ fileDesc fd)
    +
    179 | export %inline
    +
    180 | toFD : ErrIO io => PrimIO CInt -> io Fd
    +
    181 | toFD = toVal (MkFd . cast)
    + +
    183 | --------------------------------------------------------------------------------
    +
    184 | -- File Operations
    +
    185 | --------------------------------------------------------------------------------
    -
    187 |   ||| Reads at most `n` bytes from a file into an allocated pointer.
    -
    188 |   export %inline
    -
    189 |   readPtr : AnyPtr -> (n : Bits32) -> IO (Either Errno Bits32)
    -
    190 |   readPtr ptr n = toSize $ prim__readptr (fileDesc fd) ptr n
    +
    187 | ||| Tries to open a file with the given flags and mode.
    +
    188 | export %inline
    +
    189 | openFile : ErrIO io => String -> Flags -> Mode -> io Fd
    +
    190 | openFile p (F f) (M m) = toFD (prim__open p f m)
    -
    192 |   ||| Reads at most `n` bytes from a file into a buffer.
    -
    193 |   export %inline
    -
    194 |   readRaw : Buffer -> (n : Bits32) -> IO (Either Errno Bits32)
    -
    195 |   readRaw buf n = toSize $ prim__read (fileDesc fd) buf n
    - -
    197 |   ||| Reads at most `n` bytes from a file into a bytestring.
    -
    198 |   export
    -
    199 |   read : (n : Bits32) -> IO (Either Errno ByteString)
    -
    200 |   read n = toBytes n $  prim__read (fileDesc fd)
    - -
    202 |   ||| Atomically reads up to `n` bytes from the given file at
    -
    203 |   ||| the given file offset.
    -
    204 |   |||
    -
    205 |   ||| Notes: This will only work with seekable files but not with
    -
    206 |   |||        arbitrary data streams such as pipes or sockets.
    -
    207 |   |||        Also, it will not change the position of the open file description.
    -
    208 |   export
    -
    209 |   pread : (n : Bits32) -> OffT -> IO (Either Errno ByteString)
    -
    210 |   pread n off = toBytes n $ \b,x => prim__pread (fileDesc fd) b x off
    - -
    212 |   ||| Writes up to the number of bytes in the bytestring
    -
    213 |   ||| to the given file.
    -
    214 |   |||
    -
    215 |   ||| Note: This is an atomic operation if `fd` is a regular file that
    -
    216 |   |||       was opened in "append" mode (with the `O_APPEND` flag).
    +
    192 | parameters {auto fid : FileDesc a}
    +
    193 |            {auto has : ErrIO io}
    +
    194 |            (fd       : a)
    + +
    196 |   ||| Closes a file descriptor.
    +
    197 |   export %inline
    +
    198 |   close : io ()
    +
    199 |   close = toUnit (prim__close $ fileDesc fd)
    + +
    201 |   ||| Reads at most `n` bytes from a file into an allocated pointer.
    +
    202 |   export %inline
    +
    203 |   readPtr : AnyPtr -> (n : Bits32) -> io Bits32
    +
    204 |   readPtr ptr n = toSize $ prim__readptr (fileDesc fd) ptr n
    + +
    206 |   ||| Reads at most `n * sizeof a` bytes into a preallocated array.
    +
    207 |   export %inline
    +
    208 |   readArr : {n : _} -> SizeOf b => CArrayIO n b -> io Bits32
    +
    209 |   readArr p = readPtr (unsafeUnwrap p) (cast $ n * sizeof b)
    + +
    211 |   ||| Reads at most `n` bytes from a file into a buffer.
    +
    212 |   export %inline
    +
    213 |   readRaw : Buffer -> (n : Bits32) -> io Bits32
    +
    214 |   readRaw buf n = toSize $ prim__read (fileDesc fd) buf n
    + +
    216 |   ||| Reads at most `n` bytes from a file into a bytestring.
    217 |   export
    -
    218 |   writeBytes : ByteString -> IO (Either Errno Bits32)
    -
    219 |   writeBytes (BS n $ BV b o _) =
    -
    220 |     toSize $ prim__write (fileDesc fd) (unsafeGetBuffer b) (cast o) (cast n)
    - -
    222 |   ||| Reads at most `n` bytes from a file into a bytestring.
    -
    223 |   export %inline
    -
    224 |   writeRaw : Buffer -> (offset,n : Bits32) -> IO (Either Errno Bits32)
    -
    225 |   writeRaw buf o n = toSize $ prim__write (fileDesc fd) buf o n
    - - -
    228 |   ||| Atomically writes up to the number of bytes in the bytestring
    -
    229 |   ||| to the given file at the given file offset.
    -
    230 |   |||
    -
    231 |   ||| Notes: This will only work with seekable files but not with
    -
    232 |   |||        arbitrary data streams such as pipes or sockets.
    -
    233 |   |||        Also, it will not change the position of the open file description.
    -
    234 |   export
    -
    235 |   pwriteBytes : ByteString -> OffT -> IO (Either Errno Bits32)
    -
    236 |   pwriteBytes (BS n $ BV b o _) off =
    -
    237 |     toSize $ prim__pwrite (fileDesc fd) (unsafeGetBuffer b) (cast o) (cast n) off
    - -
    239 |   export %inline
    -
    240 |   write : {n : _} -> IBuffer n -> IO (Either Errno Bits32)
    -
    241 |   write ibuf = writeBytes (fromIBuffer ibuf)
    - -
    243 |   export %inline
    -
    244 |   writeStr : String -> IO (Either Errno Bits32)
    -
    245 |   writeStr = writeBytes . fromString
    - -
    247 |   export %inline
    -
    248 |   writeStrLn : String -> IO (Either Errno Bits32)
    -
    249 |   writeStrLn = writeStr . (++ "\n")
    - -
    251 | --------------------------------------------------------------------------------
    -
    252 | -- File seeking
    -
    253 | --------------------------------------------------------------------------------
    - -
    255 |   ||| Moves the file pointer to the given offset relative to the
    -
    256 |   ||| `Whence` value.
    -
    257 |   export %inline
    -
    258 |   lseek : HasIO io => OffT -> Whence -> io OffT
    -
    259 |   lseek offset whence =
    -
    260 |     primIO $ prim__lseek (fileDesc fd) offset (cast $ whenceCode whence)
    - -
    262 | --------------------------------------------------------------------------------
    -
    263 | -- Duplicating file descriptors
    -
    264 | --------------------------------------------------------------------------------
    +
    218 |   read : (n : Bits32) -> io ByteString
    +
    219 |   read n = toBytes n $  prim__read (fileDesc fd)
    + +
    221 |   ||| Atomically reads up to `n` bytes from the given file at
    +
    222 |   ||| the given file offset.
    +
    223 |   |||
    +
    224 |   ||| Notes: This will only work with seekable files but not with
    +
    225 |   |||        arbitrary data streams such as pipes or sockets.
    +
    226 |   |||        Also, it will not change the position of the open file description.
    +
    227 |   export
    +
    228 |   pread : (n : Bits32) -> OffT -> io ByteString
    +
    229 |   pread n off = toBytes n $ \b,x => prim__pread (fileDesc fd) b x off
    + +
    231 |   ||| Writes up to the number of bytes in the bytestring
    +
    232 |   ||| to the given file.
    +
    233 |   |||
    +
    234 |   ||| Note: This is an atomic operation if `fd` is a regular file that
    +
    235 |   |||       was opened in "append" mode (with the `O_APPEND` flag).
    +
    236 |   export
    +
    237 |   writeBytes : ByteString -> io Bits32
    +
    238 |   writeBytes (BS n $ BV b o _) =
    +
    239 |     toSize $ prim__write (fileDesc fd) (unsafeGetBuffer b) (cast o) (cast n)
    + +
    241 |   ||| Writes up to the given number of bytes from the given buffer starting
    +
    242 |   ||| at the given offset.
    +
    243 |   |||
    +
    244 |   ||| Note: This is an atomic operation if `fd` is a regular file that
    +
    245 |   |||       was opened in "append" mode (with the `O_APPEND` flag).
    +
    246 |   export %inline
    +
    247 |   writeRaw : Buffer -> (offset,n : Bits32) -> io Bits32
    +
    248 |   writeRaw buf o n = toSize $ prim__write (fileDesc fd) buf o n
    + +
    250 |   ||| Writes up to the number of bytes from the given C ptr.
    +
    251 |   |||
    +
    252 |   ||| Note: This is an atomic operation if `fd` is a regular file that
    +
    253 |   |||       was opened in "append" mode (with the `O_APPEND` flag).
    +
    254 |   export %inline
    +
    255 |   writePtr : AnyPtr -> (n : Bits32) -> io Bits32
    +
    256 |   writePtr buf n = toSize $ prim__writeptr (fileDesc fd) buf 0 n
    + +
    258 |   ||| Writes the content of the given array.
    +
    259 |   |||
    +
    260 |   ||| Note: This is an atomic operation if `fd` is a regular file that
    +
    261 |   |||       was opened in "append" mode (with the `O_APPEND` flag).
    +
    262 |   export %inline
    +
    263 |   writeArr : {n : _} -> SizeOf b => CArrayIO n b -> io Bits32
    +
    264 |   writeArr p = writePtr (unsafeUnwrap p) (cast $ n * sizeof b)
    -
    266 |   ||| Duplicates the given open file descriptor.
    -
    267 |   |||
    -
    268 |   ||| The duplicate is guaranteed to be given the smallest available
    -
    269 |   ||| file descriptor.
    -
    270 |   export %inline
    -
    271 |   dup : IO (Either Errno Fd)
    -
    272 |   dup = toFD $ prim__dup (fileDesc fd)
    - -
    274 |   ||| Duplicates the given open file descriptor.
    -
    275 |   |||
    -
    276 |   ||| The new file descriptor vill have the integer value of `fd2`.
    -
    277 |   ||| This is an atomic operation that will close `fd2` if it is still open.
    + +
    267 |   ||| Atomically writes up to the number of bytes in the bytestring
    +
    268 |   ||| to the given file at the given file offset.
    +
    269 |   |||
    +
    270 |   ||| Notes: This will only work with seekable files but not with
    +
    271 |   |||        arbitrary data streams such as pipes or sockets.
    +
    272 |   |||        Also, it will not change the position of the open file description.
    +
    273 |   export
    +
    274 |   pwriteBytes : ByteString -> OffT -> io Bits32
    +
    275 |   pwriteBytes (BS n $ BV b o _) off =
    +
    276 |     toSize $ prim__pwrite (fileDesc fd) (unsafeGetBuffer b) (cast o) (cast n) off
    +
    278 |   export %inline
    -
    279 |   dup2 : FileDesc b => (fd2 : b) -> IO (Either Errno Fd)
    -
    280 |   dup2 fd2 = toFD $ prim__dup2 (fileDesc fd) (fileDesc fd2)
    +
    279 |   write : {n : _} -> IBuffer n -> io Bits32
    +
    280 |   write ibuf = writeBytes (fromIBuffer ibuf)
    -
    282 |   ||| Duplicates the given open file descriptor.
    -
    283 |   |||
    -
    284 |   ||| The new file descriptor vill have the integer value of `fd2`.
    -
    285 |   ||| This is an atomic operation that will close `fd2` if it is still open.
    +
    282 |   export %inline
    +
    283 |   writeStr : String -> io Bits32
    +
    284 |   writeStr = writeBytes . fromString
    +
    286 |   export %inline
    -
    287 |   dupfd : (start : Bits32) -> IO (Either Errno Fd)
    -
    288 |   dupfd fd2 = toFD $ prim__dupfd (fileDesc fd) fd2
    +
    287 |   writeStrLn : String -> io Bits32
    +
    288 |   writeStrLn = writeStr . (++ "\n")
    290 | --------------------------------------------------------------------------------
    -
    291 | -- Setting and getting file flags
    +
    291 | -- File seeking
    292 | --------------------------------------------------------------------------------
    -
    294 |   ||| Gets the flags set at an open file descriptor.
    -
    295 |   export
    -
    296 |   getFlags : IO (Either Errno Flags)
    -
    297 |   getFlags  =
    -
    298 |     fromPrim $ \w =>
    -
    299 |       let MkIORes r w := prim__getFlags (fileDesc fd) w
    -
    300 |        in case r < 0 of
    -
    301 |             True  => MkIORes (negErr r) w
    -
    302 |             False => MkIORes (Right $ F r) w
    - -
    304 |   ||| Sets the flags of an open file descriptor.
    -
    305 |   |||
    -
    306 |   ||| Note: This replaces the currently set flags. See also `addFlags`.
    -
    307 |   export %inline
    -
    308 |   setFlags : Flags -> IO (Either Errno ())
    -
    309 |   setFlags (F fs) = toUnit $ prim__setFlags (fileDesc fd) fs
    - -
    311 |   ||| Adds the given flags to the flags set for an open
    -
    312 |   ||| file descriptor by ORing them with the currently set flags.
    -
    313 |   export
    -
    314 |   addFlags : Flags -> IO (Either Errno ())
    -
    315 |   addFlags fs =
    -
    316 |     getFlags >>= \case
    -
    317 |       Right x => setFlags (x <+> fs)
    -
    318 |       Left  x => pure (Left x)
    - -
    320 |   ||| Truncates a file to the given length.
    -
    321 |   export %inline
    -
    322 |   ftruncate : OffT -> IO (Either Errno ())
    -
    323 |   ftruncate len = toUnit $ prim__ftruncate (fileDesc fd) len
    - -
    325 | ||| Truncates a file to the given length.
    -
    326 | export %inline
    -
    327 | truncate : String -> OffT -> IO (Either Errno ())
    -
    328 | truncate f len = toUnit $ prim__truncate f len
    - -
    330 | ||| Atomically creates and opens a temporary, unique file.
    -
    331 | export
    -
    332 | mkstemp : String -> IO (Either Errno (Fd, String))
    -
    333 | mkstemp f =
    -
    334 |   let pat := "\{f}XXXXXX"
    -
    335 |       len := stringByteLength pat
    -
    336 |    in do
    -
    337 |         buf <- fromPrim $ prim__newBuf (cast len)
    -
    338 |         setString buf 0 pat
    -
    339 |         Right fd <- toFD (prim__mkstemp buf) | Left x => pure (Left x)
    -
    340 |         str <- getString buf 0 len
    -
    341 |         pure $ Right (fd, str)
    - -
    343 | --------------------------------------------------------------------------------
    -
    344 | -- Links
    -
    345 | --------------------------------------------------------------------------------
    +
    294 |   ||| Moves the file pointer to the given offset relative to the
    +
    295 |   ||| `Whence` value.
    +
    296 |   export %inline
    +
    297 |   lseek : HasIO io => OffT -> Whence -> io OffT
    +
    298 |   lseek offset whence =
    +
    299 |     primIO $ prim__lseek (fileDesc fd) offset (cast $ whenceCode whence)
    + +
    301 | --------------------------------------------------------------------------------
    +
    302 | -- Duplicating file descriptors
    +
    303 | --------------------------------------------------------------------------------
    + +
    305 |   ||| Duplicates the given open file descriptor.
    +
    306 |   |||
    +
    307 |   ||| The duplicate is guaranteed to be given the smallest available
    +
    308 |   ||| file descriptor.
    +
    309 |   export %inline
    +
    310 |   dup : io Fd
    +
    311 |   dup = toFD $ prim__dup (fileDesc fd)
    + +
    313 |   ||| Duplicates the given open file descriptor.
    +
    314 |   |||
    +
    315 |   ||| The new file descriptor vill have the integer value of `fd2`.
    +
    316 |   ||| This is an atomic operation that will close `fd2` if it is still open.
    +
    317 |   export %inline
    +
    318 |   dup2 : FileDesc b => (fd2 : b) -> io Fd
    +
    319 |   dup2 fd2 = toFD $ prim__dup2 (fileDesc fd) (fileDesc fd2)
    + +
    321 |   ||| Duplicates the given open file descriptor.
    +
    322 |   |||
    +
    323 |   ||| The new file descriptor vill have the integer value of `fd2`.
    +
    324 |   ||| This is an atomic operation that will close `fd2` if it is still open.
    +
    325 |   export %inline
    +
    326 |   dupfd : (start : Bits32) -> io Fd
    +
    327 |   dupfd fd2 = toFD $ prim__dupfd (fileDesc fd) fd2
    + +
    329 | --------------------------------------------------------------------------------
    +
    330 | -- Setting and getting file flags
    +
    331 | --------------------------------------------------------------------------------
    + +
    333 |   ||| Gets the flags set at an open file descriptor.
    +
    334 |   export
    +
    335 |   getFlags : io Flags
    +
    336 |   getFlags  = do
    +
    337 |     r <- primIO $ prim__getFlags (fileDesc fd)
    +
    338 |     if r < 0 then error (fromNeg r) else pure (F $ cast r)
    + +
    340 |   ||| Sets the flags of an open file descriptor.
    +
    341 |   |||
    +
    342 |   ||| Note: This replaces the currently set flags. See also `addFlags`.
    +
    343 |   export %inline
    +
    344 |   setFlags : Flags -> io ()
    +
    345 |   setFlags (F fs) = toUnit $ prim__setFlags (fileDesc fd) fs
    -
    347 | ||| Creates a (hard) link to a file.
    -
    348 | export %inline
    -
    349 | link : (file, link : String) -> IO (Either Errno ())
    -
    350 | link f l = toUnit $ prim__link f l
    - -
    352 | ||| Creates a (hard) link to a file.
    -
    353 | export %inline
    -
    354 | symlink : (file, link : String) -> IO (Either Errno ())
    -
    355 | symlink f l = toUnit $ prim__symlink f l
    - -
    357 | ||| Deletes a (hard) link to a file.
    - -
    359 | ||| If this is the last link to the file, the file is removed.
    - -
    361 | ||| Note: Files with open file descriptors will only be deleted after the last
    -
    362 | |||       open file descriptor is closed, but the file name will already
    -
    363 | |||       disapper from the file system before that.
    -
    364 | export %inline
    -
    365 | unlink : (file : String) -> IO (Either Errno ())
    -
    366 | unlink f = toUnit $ prim__unlink f
    - -
    368 | ||| Removes a file or (empty) directory calling `unlink` or `rmdir`
    -
    369 | ||| internally.
    -
    370 | export %inline
    -
    371 | remove : (file : String) -> IO (Either Errno ())
    -
    372 | remove f = toUnit $ prim__remove f
    - -
    374 | ||| Renames a file within a file system.
    - -
    376 | ||| Note: This will fail if the two paths point to different file systems.
    -
    377 | |||       In that case, the file needs to be copied from one FS to the other.
    -
    378 | export %inline
    -
    379 | rename : (file, link : String) -> IO (Either Errno ())
    -
    380 | rename f l = toUnit $ prim__rename f l
    - -
    382 | ||| Returns the path of a file a symbolic link points to
    - -
    384 | ||| This allocates a buffer of 4096 bytes for the byte array holding
    -
    385 | ||| the result.
    +
    347 |   ||| Adds the given flags to the flags set for an open
    +
    348 |   ||| file descriptor by ORing them with the currently set flags.
    +
    349 |   export
    +
    350 |   addFlags : Flags -> io ()
    +
    351 |   addFlags fs = getFlags >>= \x => setFlags (x <+> fs)
    + +
    353 |   ||| Truncates a file to the given length.
    +
    354 |   export %inline
    +
    355 |   ftruncate : OffT -> io ()
    +
    356 |   ftruncate len = toUnit $ prim__ftruncate (fileDesc fd) len
    + +
    358 | ||| Truncates a file to the given length.
    +
    359 | export %inline
    +
    360 | truncate : ErrIO io => String -> OffT -> io ()
    +
    361 | truncate f len = toUnit $ prim__truncate f len
    + +
    363 | ||| Atomically creates and opens a temporary, unique file.
    +
    364 | export
    +
    365 | mkstemp : ErrIO io => String -> io (Fd, String)
    +
    366 | mkstemp f =
    +
    367 |   let pat := "\{f}XXXXXX"
    +
    368 |       len := stringByteLength pat
    +
    369 |    in do
    +
    370 |         buf <- primIO $ prim__newBuf (cast len)
    +
    371 |         setString buf 0 pat
    +
    372 |         fd <- toFD (prim__mkstemp buf)
    +
    373 |         str <- getString buf 0 len
    +
    374 |         pure (fd, str)
    + +
    376 | --------------------------------------------------------------------------------
    +
    377 | -- Links
    +
    378 | --------------------------------------------------------------------------------
    + +
    380 | ||| Creates a (hard) link to a file.
    +
    381 | export %inline
    +
    382 | link : ErrIO io => (file, link : String) -> io ()
    +
    383 | link f l = toUnit $ prim__link f l
    + +
    385 | ||| Creates a (hard) link to a file.
    386 | export %inline
    -
    387 | readlink : (file : String) -> IO (Either Errno ByteString)
    -
    388 | readlink f = toBytes 4096 $ prim__readlink f
    +
    387 | symlink : ErrIO io => (file, link : String) -> io ()
    +
    388 | symlink f l = toUnit $ prim__symlink f l
    -
    390 | --------------------------------------------------------------------------------
    -
    391 | -- Standard input and output
    -
    392 | --------------------------------------------------------------------------------
    - -
    394 | export %inline
    -
    395 | stdout : HasIO io => String -> io ()
    -
    396 | stdout = liftIO . ignore . writeStr Stdout
    - -
    398 | export %inline
    -
    399 | stdoutLn : HasIO io => String -> io ()
    -
    400 | stdoutLn = liftIO . ignore . writeStrLn Stdout
    - +
    390 | ||| Deletes a (hard) link to a file.
    + +
    392 | ||| If this is the last link to the file, the file is removed.
    + +
    394 | ||| Note: Files with open file descriptors will only be deleted after the last
    +
    395 | |||       open file descriptor is closed, but the file name will already
    +
    396 | |||       disapper from the file system before that.
    +
    397 | export %inline
    +
    398 | unlink : ErrIO io => (file : String) -> io ()
    +
    399 | unlink f = toUnit $ prim__unlink f
    + +
    401 | ||| Removes a file or (empty) directory calling `unlink` or `rmdir`
    +
    402 | ||| internally.
    +
    403 | export %inline
    +
    404 | remove : ErrIO io => (file : String) -> io ()
    +
    405 | remove f = toUnit $ prim__remove f
    + +
    407 | ||| Renames a file within a file system.
    + +
    409 | ||| Note: This will fail if the two paths point to different file systems.
    +
    410 | |||       In that case, the file needs to be copied from one FS to the other.
    +
    411 | export %inline
    +
    412 | rename : ErrIO io => (file, link : String) -> io ()
    +
    413 | rename f l = toUnit $ prim__rename f l
    + +
    415 | ||| Returns the path of a file a symbolic link points to
    + +
    417 | ||| This allocates a buffer of 4096 bytes for the byte array holding
    +
    418 | ||| the result.
    +
    419 | export %inline
    +
    420 | readlink : ErrIO io => (file : String) -> io ByteString
    +
    421 | readlink f = toBytes 4096 $ prim__readlink f
    + +
    423 | --------------------------------------------------------------------------------
    +
    424 | -- Standard input and output
    +
    425 | --------------------------------------------------------------------------------
    + +
    427 | export %inline
    +
    428 | stdout : ErrIO io => String -> io ()
    +
    429 | stdout = ignore . writeStr Stdout
    + +
    431 | export %inline
    +
    432 | stdoutLn : ErrIO io => String -> io ()
    +
    433 | stdoutLn = ignore . writeStrLn Stdout
    + +
    435 | export %inline
    +
    436 | prnt : ErrIO io => Show a => a -> io ()
    +
    437 | prnt = stdout . show
    + +
    439 | export %inline
    +
    440 | prntLn : ErrIO io => Show a => a -> io ()
    +
    441 | prntLn = stdoutLn . show
    + +
    443 | export %inline
    +
    444 | stderr : ErrIO io => String -> io ()
    +
    445 | stderr = ignore . writeStr Stdout
    + +
    447 | export %inline
    +
    448 | stderrLn : ErrIO io => String -> io ()
    +
    449 | stderrLn = ignore . writeStrLn Stdout
    + diff --git a/docs/posix/docs/docs/System.Posix.Pipe.html b/docs/posix/docs/docs/System.Posix.Pipe.html new file mode 100644 index 000000000..e3b8d6861 --- /dev/null +++ b/docs/posix/docs/docs/System.Posix.Pipe.html @@ -0,0 +1,64 @@ + + + + + System.Posix.Pipe + + + + + +
    + Idris2Doc : System.Posix.Pipe + + + + +
    +

    System.Posix.Pipe

    (source)

    Reexports

    importpublic System.Posix.File

    Definitions

    pipe : ErrIOio=>CArrayIO2Fd->io ()
      Creates a pipe and writes the two file descriptors into the given C-array,
    the read end at position 0 the write end at position 1.

    Totality: total
    Visibility: export
    mkfifo : ErrIOio=>String->ModeT->io ()
      Creates a new FIFO (named pipe) on disc.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Pipe.src.html b/docs/posix/docs/docs/System.Posix.Pipe.src.html new file mode 100644 index 000000000..78ae4052c --- /dev/null +++ b/docs/posix/docs/docs/System.Posix.Pipe.src.html @@ -0,0 +1,154 @@ + + + + + + + + + +
     0 | module System.Posix.Pipe
    + +
     2 | import public System.Posix.File
    + +
     4 | %default total
    + +
     6 | --------------------------------------------------------------------------------
    +
     7 | -- FFI
    +
     8 | --------------------------------------------------------------------------------
    + +
    10 | %foreign "C:li_pipe, posix-idris"
    +
    11 | prim__pipe : AnyPtr -> PrimIO CInt
    + +
    13 | %foreign "C:li_mkfifo, posix-idris"
    +
    14 | prim__mkfifo : String -> ModeT -> PrimIO CInt
    + +
    16 | --------------------------------------------------------------------------------
    +
    17 | -- API
    +
    18 | --------------------------------------------------------------------------------
    + +
    20 | ||| Creates a pipe and writes the two file descriptors into the given C-array,
    +
    21 | ||| the read end at position 0 the write end at position 1.
    +
    22 | export %inline
    +
    23 | pipe : ErrIO io => CArrayIO 2 Fd -> io ()
    +
    24 | pipe p = toUnit $ prim__pipe (unsafeUnwrap p)
    + +
    26 | ||| Creates a new FIFO (named pipe) on disc.
    +
    27 | export %inline
    +
    28 | mkfifo : ErrIO io => String -> ModeT -> io ()
    +
    29 | mkfifo pth m = toUnit $ prim__mkfifo pth m
    + +
    + + diff --git a/docs/posix/docs/docs/System.Posix.Process.Flags.html b/docs/posix/docs/docs/System.Posix.Process.Flags.html index ba555de35..2f41adb10 100644 --- a/docs/posix/docs/docs/System.Posix.Process.Flags.html +++ b/docs/posix/docs/docs/System.Posix.Process.Flags.html @@ -61,4 +61,4 @@ -

    System.Posix.Process.Flags

    (source)

    Definitions

    recordWaitFlags : Type
    Totality: total
    Visibility: public export
    Constructor: 
    F : Bits32->WaitFlags

    Projection: 
    .flags : WaitFlags->Bits32

    Hints:
    EqWaitFlags
    MonoidWaitFlags
    OrdWaitFlags
    SemigroupWaitFlags
    ShowWaitFlags
    .flags : WaitFlags->Bits32
    Totality: total
    Visibility: public export
    flags : WaitFlags->Bits32
    Totality: total
    Visibility: public export
    dataIdType : Type
    Totality: total
    Visibility: public export
    Constructors:
    P_ALL : IdType
    P_PID : IdType
    P_PGID : IdType

    Hints:
    EqIdType
    OrdIdType
    ShowIdType
    WUNTRACED : WaitFlags
    Totality: total
    Visibility: public export
    WCONTINUED : WaitFlags
    Totality: total
    Visibility: public export
    WNOHANG : WaitFlags
    Totality: total
    Visibility: public export
    WEXITED : WaitFlags
    Totality: total
    Visibility: public export
    WSTOPPED : WaitFlags
    Totality: total
    Visibility: public export
    WNOWAIT : WaitFlags
    Totality: total
    Visibility: public export
    idtypeCode : IdType->Bits8
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Process.Flags

    (source)

    Definitions

    recordWaitFlags : Type
    Totality: total
    Visibility: public export
    Constructor: 
    F : Bits32->WaitFlags

    Projection: 
    .flags : WaitFlags->Bits32

    Hints:
    EqWaitFlags
    MonoidWaitFlags
    OrdWaitFlags
    SemigroupWaitFlags
    ShowWaitFlags
    .flags : WaitFlags->Bits32
    Totality: total
    Visibility: public export
    flags : WaitFlags->Bits32
    Totality: total
    Visibility: public export
    dataIdType : Type
    Totality: total
    Visibility: public export
    Constructors:
    P_ALL : IdType
    P_PID : IdType
    P_PGID : IdType

    Hints:
    EqIdType
    OrdIdType
    ShowIdType
    WUNTRACED : WaitFlags
    Totality: total
    Visibility: public export
    WCONTINUED : WaitFlags
    Totality: total
    Visibility: public export
    WNOHANG : WaitFlags
    Totality: total
    Visibility: public export
    WEXITED : WaitFlags
    Totality: total
    Visibility: public export
    WSTOPPED : WaitFlags
    Totality: total
    Visibility: public export
    WNOWAIT : WaitFlags
    Totality: total
    Visibility: public export
    idtypeCode : IdType->Bits8
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Process.html b/docs/posix/docs/docs/System.Posix.Process.html index b92fa78a2..05e5cbbc8 100644 --- a/docs/posix/docs/docs/System.Posix.Process.html +++ b/docs/posix/docs/docs/System.Posix.Process.html @@ -61,4 +61,4 @@ -

    System.Posix.Process

    (source)

    Reexports

    importpublic Data.C.Ptr
    importpublic System.Posix.Errno
    importpublic System.Posix.Process.Flags

    Definitions

    getpid : HasIOio=>ioPidT
      Returns the process ID of the current process

    Totality: total
    Visibility: export
    getppid : HasIOio=>ioPidT
      Returns the process ID of the current process' parent process

    Totality: total
    Visibility: export
    getuid : HasIOio=>ioUidT
      Returns the real user ID of the current process

    Totality: total
    Visibility: export
    geteuid : HasIOio=>ioUidT
      Returns the effective user ID of the current process

    Totality: total
    Visibility: export
    getgid : HasIOio=>ioGidT
      Returns the real group ID of the current process

    Totality: total
    Visibility: export
    getegid : HasIOio=>ioGidT
      Returns the effective group ID of the current process

    Totality: total
    Visibility: export
    setuid : UidT->IO (EitherErrno ())
      Tries to set the real user ID of the current process

    Totality: total
    Visibility: export
    seteuid : UidT->IO (EitherErrno ())
      Tries to set the effective user ID of the current process

    Totality: total
    Visibility: export
    setgid : GidT->IO (EitherErrno ())
      Tries to set the real group ID of the current process

    Totality: total
    Visibility: export
    setegid : GidT->IO (EitherErrno ())
      Tries to set the effective group ID of the current process

    Totality: total
    Visibility: export
    recordProcStatus : Type
      Process status returned by a call to `wait` or `waitpid`.

    Totality: total
    Visibility: public export
    Constructor: 
    PS : CInt->ProcStatus

    Projection: 
    .status : ProcStatus->CInt

    Hints:
    DerefProcStatus
    SetPtrProcStatus
    SizeOfProcStatus
    .status : ProcStatus->CInt
    Totality: total
    Visibility: public export
    status : ProcStatus->CInt
    Totality: total
    Visibility: public export
    fork : IO (EitherErrnoPidT)
      Creates a new child process.

    This creates a new process by copying the stack, head, and
    data memory segment of the parent process. If successful,
    the functions returns `0` for the child process and
    the child's process ID for the parent.

    Totality: total
    Visibility: export
    execve : String->CArrayIOm (MaybeString) ->CArrayIOn (MaybeString) ->IO (EitherErrno ())
      Loads a new program into this process's memory.

    `path` : The path of the program to run
    `args` : Command-line arguments (a `NULL` terminated array of strings)
    `env ` : Environment (a `NULL` terminated array of strings of the for "a=b")

    This only returns in case of an error.

    Totality: total
    Visibility: export
    execle : String->ListString->List (String, String) ->IO (EitherErrno ())
      Convenience alias of `execve` that uses Idris lists for passing
    the arguments list and environment.

    Totality: total
    Visibility: export
    execv : String->CArrayIOm (MaybeString) ->IO (EitherErrno ())
      Like `execve` but uses the environment of the current process.

    Totality: total
    Visibility: export
    execvp : String->CArrayIOm (MaybeString) ->IO (EitherErrno ())
      Like `execv` but allows us to just use a filename
    and resolve in using the `$PATH` variable.

    Totality: total
    Visibility: export
    execlp : String->ListString->IO (EitherErrno ())
      Convenience alias for `execvp` that uses an Idris list for
    the list of arguments.

    Totality: total
    Visibility: export
    system : String->IO (EitherErrnoProcStatus)
      Runs the given shell command in a child process.

    This has a slightly different type signature that the actual
    `system` call in C, which allows us to use the same mechanism
    as with `wait` to get the returned exit status.

    Totality: total
    Visibility: export
    wait : BoxProcStatus->IO (EitherErrnoPidT)
      Waits for one of the child processes of this process to
    terminate.

    On success, this returns the process ID of the child process
    that terminated. In addition, the termination status of the child
    is written into the given pointer.

    Totality: total
    Visibility: export
    waitpid : PidT->BoxProcStatus->WaitFlags->IO (EitherErrnoPidT)
      Waits for the given child processes of to terminate.

    Unlike `wait`, this allows us to wait on a specific child process.
    In addition, it is possible to be notified about child processes that have
    been terminated by a signal.

    Totality: total
    Visibility: export
    waitid : IdType->PidT->SiginfoT->WaitFlags->IO (EitherErrno ())
      More powerful version of `waitpid` supporting additional flags and
    waiting on groups of children. Wait results are stored in the
    provided `SiginfoT` pointer.

    Totality: total
    Visibility: export
    exited : ProcStatus->Bool
      `True` if the process exited normally.

    Totality: total
    Visibility: export
    exitstatus : ProcStatus->Bits8
      Returns the exit status with which the process exited.

    Totality: total
    Visibility: export
    signaled : ProcStatus->Bool
      `True` if the process has been killed by a signal.

    Totality: total
    Visibility: export
    termsig : ProcStatus->Signal
      Returns the signal the process was killed with.

    Totality: total
    Visibility: export
    coredump : ProcStatus->Bool
      `True` if the process has dumped core.

    Totality: total
    Visibility: export
    stopped : ProcStatus->Bool
      `True` if the process has been stopped by a signal.

    Totality: total
    Visibility: export
    stopsig : ProcStatus->Signal
      Returns the signal the process was stopped with.

    Totality: total
    Visibility: export
    continued : ProcStatus->Bool
      `True` if the process has been awakend with `SIGCONT`.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Process

    (source)

    Reexports

    importpublic Data.C.Ptr
    importpublic System.Posix.Errno
    importpublic System.Posix.Process.Flags

    Definitions

    getpid : HasIOio=>ioPidT
      Returns the process ID of the current process

    Totality: total
    Visibility: export
    getppid : HasIOio=>ioPidT
      Returns the process ID of the current process' parent process

    Totality: total
    Visibility: export
    getuid : HasIOio=>ioUidT
      Returns the real user ID of the current process

    Totality: total
    Visibility: export
    geteuid : HasIOio=>ioUidT
      Returns the effective user ID of the current process

    Totality: total
    Visibility: export
    getgid : HasIOio=>ioGidT
      Returns the real group ID of the current process

    Totality: total
    Visibility: export
    getegid : HasIOio=>ioGidT
      Returns the effective group ID of the current process

    Totality: total
    Visibility: export
    setuid : ErrIOio=>UidT->io ()
      Tries to set the real user ID of the current process

    Totality: total
    Visibility: export
    seteuid : ErrIOio=>UidT->io ()
      Tries to set the effective user ID of the current process

    Totality: total
    Visibility: export
    setgid : ErrIOio=>GidT->io ()
      Tries to set the real group ID of the current process

    Totality: total
    Visibility: export
    setegid : ErrIOio=>GidT->io ()
      Tries to set the effective group ID of the current process

    Totality: total
    Visibility: export
    recordProcStatus : Type
      Process status returned by a call to `wait` or `waitpid`.

    Totality: total
    Visibility: public export
    Constructor: 
    PS : CInt->ProcStatus

    Projection: 
    .status : ProcStatus->CInt

    Hints:
    DerefProcStatus
    SetPtrProcStatus
    SizeOfProcStatus
    .status : ProcStatus->CInt
    Totality: total
    Visibility: public export
    status : ProcStatus->CInt
    Totality: total
    Visibility: public export
    fork : ErrIOio=>ioPidT
      Creates a new child process.

    This creates a new process by copying the stack, head, and
    data memory segment of the parent process. If successful,
    the functions returns `0` for the child process and
    the child's process ID for the parent.

    Totality: total
    Visibility: export
    execve : ErrIOio=>String->CArrayIOm (MaybeString) ->CArrayIOn (MaybeString) ->io ()
      Loads a new program into this process's memory.

    `path` : The path of the program to run
    `args` : Command-line arguments (a `NULL` terminated array of strings)
    `env ` : Environment (a `NULL` terminated array of strings of the for "a=b")

    This only returns in case of an error.

    Totality: total
    Visibility: export
    execle : ErrIOio=>String->ListString->List (String, String) ->io ()
      Convenience alias of `execve` that uses Idris lists for passing
    the arguments list and environment.

    Totality: total
    Visibility: export
    execv : ErrIOio=>String->CArrayIOm (MaybeString) ->io ()
      Like `execve` but uses the environment of the current process.

    Totality: total
    Visibility: export
    execvp : ErrIOio=>String->CArrayIOm (MaybeString) ->io ()
      Like `execv` but allows us to just use a filename
    and resolve in using the `$PATH` variable.

    Totality: total
    Visibility: export
    execlp : ErrIOio=>String->ListString->io ()
      Convenience alias for `execvp` that uses an Idris list for
    the list of arguments.

    Totality: total
    Visibility: export
    system : ErrIOio=>String->ioProcStatus
      Runs the given shell command in a child process.

    This has a slightly different type signature that the actual
    `system` call in C, which allows us to use the same mechanism
    as with `wait` to get the returned exit status.

    Totality: total
    Visibility: export
    wait : ErrIOio=>BoxProcStatus->ioPidT
      Waits for one of the child processes of this process to
    terminate.

    On success, this returns the process ID of the child process
    that terminated. In addition, the termination status of the child
    is written into the given pointer.

    Totality: total
    Visibility: export
    waitpid : ErrIOio=>PidT->BoxProcStatus->WaitFlags->ioPidT
      Waits for the given child processes of to terminate.

    Unlike `wait`, this allows us to wait on a specific child process.
    In addition, it is possible to be notified about child processes that have
    been terminated by a signal.

    Totality: total
    Visibility: export
    waitid : ErrIOio=>IdType->PidT->SiginfoT->WaitFlags->io ()
      More powerful version of `waitpid` supporting additional flags and
    waiting on groups of children. Wait results are stored in the
    provided `SiginfoT` pointer.

    Totality: total
    Visibility: export
    exited : ProcStatus->Bool
      `True` if the process exited normally.

    Totality: total
    Visibility: export
    exitstatus : ProcStatus->Bits8
      Returns the exit status with which the process exited.

    Totality: total
    Visibility: export
    signaled : ProcStatus->Bool
      `True` if the process has been killed by a signal.

    Totality: total
    Visibility: export
    termsig : ProcStatus->Signal
      Returns the signal the process was killed with.

    Totality: total
    Visibility: export
    coredump : ProcStatus->Bool
      `True` if the process has dumped core.

    Totality: total
    Visibility: export
    stopped : ProcStatus->Bool
      `True` if the process has been stopped by a signal.

    Totality: total
    Visibility: export
    stopsig : ProcStatus->Signal
      Returns the signal the process was stopped with.

    Totality: total
    Visibility: export
    continued : ProcStatus->Bool
      `True` if the process has been awakend with `SIGCONT`.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Process.src.html b/docs/posix/docs/docs/System.Posix.Process.src.html index 898b54e8c..a55174f87 100644 --- a/docs/posix/docs/docs/System.Posix.Process.src.html +++ b/docs/posix/docs/docs/System.Posix.Process.src.html @@ -246,22 +246,22 @@
    126 | ||| Tries to set the real user ID of the current process
    127 | export %inline
    -
    128 | setuid : UidT -> IO (Either Errno ())
    +
    128 | setuid : ErrIO io => UidT -> io ()
    129 | setuid uid = toUnit $ prim__setuid uid
    131 | ||| Tries to set the effective user ID of the current process
    132 | export %inline
    -
    133 | seteuid : UidT -> IO (Either Errno ())
    +
    133 | seteuid : ErrIO io => UidT -> io ()
    134 | seteuid uid = toUnit $ prim__seteuid uid
    136 | ||| Tries to set the real group ID of the current process
    137 | export %inline
    -
    138 | setgid : GidT -> IO (Either Errno ())
    +
    138 | setgid : ErrIO io => GidT -> io ()
    139 | setgid gid = toUnit $ prim__setgid gid
    141 | ||| Tries to set the effective group ID of the current process
    142 | export %inline
    -
    143 | setegid : GidT -> IO (Either Errno ())
    +
    143 | setegid : ErrIO io => GidT -> io ()
    144 | setegid gid = toUnit $ prim__setegid gid
    146 | ||| Process status returned by a call to `wait` or `waitpid`.
    @@ -289,7 +289,7 @@
    168 | ||| the functions returns `0` for the child process and
    169 | ||| the child's process ID for the parent.
    170 | export %inline
    -
    171 | fork : IO (Either Errno PidT)
    +
    171 | fork : ErrIO io => io PidT
    172 | fork = toPidT Process.prim__fork
    174 | ||| Loads a new program into this process's memory.
    @@ -301,125 +301,126 @@
    180 | ||| This only returns in case of an error.
    181 | export %inline
    182 | execve :
    -
    183 |      String
    -
    184 |   -> (args : CArrayIO m (Maybe String))
    -
    185 |   -> (env  : CArrayIO n (Maybe String))
    -
    186 |   -> IO (Either Errno ())
    -
    187 | execve s a e = toUnit $ prim__execve s (unsafeUnwrap a) (unsafeUnwrap e)
    - -
    189 | ||| Convenience alias of `execve` that uses Idris lists for passing
    -
    190 | ||| the arguments list and environment.
    -
    191 | export
    -
    192 | execle : String -> List String -> List (String,String) -> IO (Either Errno ())
    -
    193 | execle s a e = do
    -
    194 |   args <- fromListIO (map Just a ++ [Nothing])
    -
    195 |   env  <- fromListIO (map envpair e ++ [Nothing])
    -
    196 |   res  <- execve s args env
    -
    197 |   free args
    -
    198 |   free env
    -
    199 |   pure res
    - -
    201 |   where
    -
    202 |     envpair : (String,String) -> Maybe String
    -
    203 |     envpair (n,v) = Just "\{n}=\{v}"
    - -
    205 | ||| Like `execve` but uses the environment of the current process.
    -
    206 | export %inline
    -
    207 | execv : String -> CArrayIO m (Maybe String) -> IO (Either Errno ())
    -
    208 | execv s a = toUnit $ prim__execv s (unsafeUnwrap a)
    - -
    210 | ||| Like `execv` but allows us to just use a filename
    -
    211 | ||| and resolve in using the `$PATH` variable.
    -
    212 | export %inline
    -
    213 | execvp : String -> CArrayIO m (Maybe String) -> IO (Either Errno ())
    -
    214 | execvp s a = toUnit $ prim__execvp s (unsafeUnwrap a)
    - -
    216 | ||| Convenience alias for `execvp` that uses an Idris list for
    -
    217 | ||| the list of arguments.
    -
    218 | export
    -
    219 | execlp : String -> List String -> IO (Either Errno ())
    -
    220 | execlp s a = do
    -
    221 |   args <- fromListIO (map Just a ++ [Nothing])
    -
    222 |   res  <- execvp s args
    -
    223 |   free args
    -
    224 |   pure res
    - -
    226 | ||| Runs the given shell command in a child process.
    - -
    228 | ||| This has a slightly different type signature that the actual
    -
    229 | ||| `system` call in C, which allows us to use the same mechanism
    -
    230 | ||| as with `wait` to get the returned exit status.
    -
    231 | export %inline
    -
    232 | system : (cmd : String) -> IO (Either Errno ProcStatus)
    -
    233 | system cmd = toVal PS $ prim__system cmd
    - -
    235 | ||| Waits for one of the child processes of this process to
    -
    236 | ||| terminate.
    - -
    238 | ||| On success, this returns the process ID of the child process
    -
    239 | ||| that terminated. In addition, the termination status of the child
    -
    240 | ||| is written into the given pointer.
    -
    241 | export %inline
    -
    242 | wait : Box ProcStatus -> IO (Either Errno PidT)
    -
    243 | wait s = toPidT $ prim__wait (unsafeUnwrap s)
    - -
    245 | ||| Waits for the given child processes of to terminate.
    - -
    247 | ||| Unlike `wait`, this allows us to wait on a specific child process.
    -
    248 | ||| In addition, it is possible to be notified about child processes that have
    -
    249 | ||| been terminated by a signal.
    -
    250 | export %inline
    -
    251 | waitpid : PidT -> Box ProcStatus -> WaitFlags -> IO (Either Errno PidT)
    -
    252 | waitpid chld s (F f) = toPidT $ prim__waitpid chld (unsafeUnwrap s) f
    - -
    254 | ||| More powerful version of `waitpid` supporting additional flags and
    -
    255 | ||| waiting on groups of children. Wait results are stored in the
    -
    256 | ||| provided `SiginfoT` pointer.
    -
    257 | export %inline
    -
    258 | waitid : IdType -> PidT -> SiginfoT -> WaitFlags -> IO (Either Errno ())
    -
    259 | waitid t chld s (F f) =
    -
    260 |   toUnit $ prim__waitid (idtypeCode t) chld (unwrap s) f
    - -
    262 | ||| `True` if the process exited normally.
    -
    263 | export %inline
    -
    264 | exited : ProcStatus -> Bool
    -
    265 | exited s = toBool $ prim__exited s.status
    - -
    267 | ||| Returns the exit status with which the process exited.
    -
    268 | export %inline
    -
    269 | exitstatus : ProcStatus -> Bits8
    -
    270 | exitstatus s = prim__exitstatus s.status
    - -
    272 | ||| `True` if the process has been killed by a signal.
    -
    273 | export %inline
    -
    274 | signaled : ProcStatus -> Bool
    -
    275 | signaled s = toBool $ prim__signaled s.status
    - -
    277 | ||| Returns the signal the process was killed with.
    -
    278 | export %inline
    -
    279 | termsig : ProcStatus -> Signal
    -
    280 | termsig s = S $ prim__termsig s.status
    - -
    282 | ||| `True` if the process has dumped core.
    -
    283 | export %inline
    -
    284 | coredump : ProcStatus -> Bool
    -
    285 | coredump s = toBool $ prim__coredump s.status
    - -
    287 | ||| `True` if the process has been stopped by a signal.
    -
    288 | export %inline
    -
    289 | stopped : ProcStatus -> Bool
    -
    290 | stopped s = toBool $ prim__stopped s.status
    - -
    292 | ||| Returns the signal the process was stopped with.
    -
    293 | export %inline
    -
    294 | stopsig : ProcStatus -> Signal
    -
    295 | stopsig s = S $ prim__stopsig s.status
    - -
    297 | ||| `True` if the process has been awakend with `SIGCONT`.
    -
    298 | export %inline
    -
    299 | continued : ProcStatus -> Bool
    -
    300 | continued s = toBool $ prim__continued s.status
    - +
    183 |      {auto has : ErrIO io}
    +
    184 |   -> String
    +
    185 |   -> (args : CArrayIO m (Maybe String))
    +
    186 |   -> (env  : CArrayIO n (Maybe String))
    +
    187 |   -> io ()
    +
    188 | execve s a e = toUnit $ prim__execve s (unsafeUnwrap a) (unsafeUnwrap e)
    + +
    190 | ||| Convenience alias of `execve` that uses Idris lists for passing
    +
    191 | ||| the arguments list and environment.
    +
    192 | export
    +
    193 | execle : ErrIO io => String -> List String -> List (String,String) -> io ()
    +
    194 | execle s a e = do
    +
    195 |   args <- fromListIO (map Just a ++ [Nothing])
    +
    196 |   env  <- fromListIO (map envpair e ++ [Nothing])
    +
    197 |   res  <- execve s args env
    +
    198 |   free args
    +
    199 |   free env
    +
    200 |   pure res
    + +
    202 |   where
    +
    203 |     envpair : (String,String) -> Maybe String
    +
    204 |     envpair (n,v) = Just "\{n}=\{v}"
    + +
    206 | ||| Like `execve` but uses the environment of the current process.
    +
    207 | export %inline
    +
    208 | execv : ErrIO io => String -> CArrayIO m (Maybe String) -> io ()
    +
    209 | execv s a = toUnit $ prim__execv s (unsafeUnwrap a)
    + +
    211 | ||| Like `execv` but allows us to just use a filename
    +
    212 | ||| and resolve in using the `$PATH` variable.
    +
    213 | export %inline
    +
    214 | execvp : ErrIO io => String -> CArrayIO m (Maybe String) -> io ()
    +
    215 | execvp s a = toUnit $ prim__execvp s (unsafeUnwrap a)
    + +
    217 | ||| Convenience alias for `execvp` that uses an Idris list for
    +
    218 | ||| the list of arguments.
    +
    219 | export
    +
    220 | execlp : ErrIO io => String -> List String -> io ()
    +
    221 | execlp s a = do
    +
    222 |   args <- fromListIO (map Just a ++ [Nothing])
    +
    223 |   res  <- execvp s args
    +
    224 |   free args
    +
    225 |   pure res
    + +
    227 | ||| Runs the given shell command in a child process.
    + +
    229 | ||| This has a slightly different type signature that the actual
    +
    230 | ||| `system` call in C, which allows us to use the same mechanism
    +
    231 | ||| as with `wait` to get the returned exit status.
    +
    232 | export %inline
    +
    233 | system : ErrIO io => (cmd : String) -> io ProcStatus
    +
    234 | system cmd = toVal PS $ prim__system cmd
    + +
    236 | ||| Waits for one of the child processes of this process to
    +
    237 | ||| terminate.
    + +
    239 | ||| On success, this returns the process ID of the child process
    +
    240 | ||| that terminated. In addition, the termination status of the child
    +
    241 | ||| is written into the given pointer.
    +
    242 | export %inline
    +
    243 | wait : ErrIO io => Box ProcStatus -> io PidT
    +
    244 | wait s = toPidT $ prim__wait (unsafeUnwrap s)
    + +
    246 | ||| Waits for the given child processes of to terminate.
    + +
    248 | ||| Unlike `wait`, this allows us to wait on a specific child process.
    +
    249 | ||| In addition, it is possible to be notified about child processes that have
    +
    250 | ||| been terminated by a signal.
    +
    251 | export %inline
    +
    252 | waitpid : ErrIO io => PidT -> Box ProcStatus -> WaitFlags -> io PidT
    +
    253 | waitpid chld s (F f) = toPidT $ prim__waitpid chld (unsafeUnwrap s) f
    + +
    255 | ||| More powerful version of `waitpid` supporting additional flags and
    +
    256 | ||| waiting on groups of children. Wait results are stored in the
    +
    257 | ||| provided `SiginfoT` pointer.
    +
    258 | export %inline
    +
    259 | waitid : ErrIO io => IdType -> PidT -> SiginfoT -> WaitFlags -> io ()
    +
    260 | waitid t chld s (F f) =
    +
    261 |   toUnit $ prim__waitid (idtypeCode t) chld (unwrap s) f
    + +
    263 | ||| `True` if the process exited normally.
    +
    264 | export %inline
    +
    265 | exited : ProcStatus -> Bool
    +
    266 | exited s = toBool $ prim__exited s.status
    + +
    268 | ||| Returns the exit status with which the process exited.
    +
    269 | export %inline
    +
    270 | exitstatus : ProcStatus -> Bits8
    +
    271 | exitstatus s = prim__exitstatus s.status
    + +
    273 | ||| `True` if the process has been killed by a signal.
    +
    274 | export %inline
    +
    275 | signaled : ProcStatus -> Bool
    +
    276 | signaled s = toBool $ prim__signaled s.status
    + +
    278 | ||| Returns the signal the process was killed with.
    +
    279 | export %inline
    +
    280 | termsig : ProcStatus -> Signal
    +
    281 | termsig s = S $ prim__termsig s.status
    + +
    283 | ||| `True` if the process has dumped core.
    +
    284 | export %inline
    +
    285 | coredump : ProcStatus -> Bool
    +
    286 | coredump s = toBool $ prim__coredump s.status
    + +
    288 | ||| `True` if the process has been stopped by a signal.
    +
    289 | export %inline
    +
    290 | stopped : ProcStatus -> Bool
    +
    291 | stopped s = toBool $ prim__stopped s.status
    + +
    293 | ||| Returns the signal the process was stopped with.
    +
    294 | export %inline
    +
    295 | stopsig : ProcStatus -> Signal
    +
    296 | stopsig s = S $ prim__stopsig s.status
    + +
    298 | ||| `True` if the process has been awakend with `SIGCONT`.
    +
    299 | export %inline
    +
    300 | continued : ProcStatus -> Bool
    +
    301 | continued s = toBool $ prim__continued s.status
    + diff --git a/docs/posix/docs/docs/System.Posix.Pthreads.Types.html b/docs/posix/docs/docs/System.Posix.Pthreads.Types.html index 1cf9ff3e4..6a1bf99ec 100644 --- a/docs/posix/docs/docs/System.Posix.Pthreads.Types.html +++ b/docs/posix/docs/docs/System.Posix.Pthreads.Types.html @@ -61,4 +61,4 @@ -

    System.Posix.Pthreads.Types

    (source)

    Definitions

    dataMutexType : Type
    Totality: total
    Visibility: public export
    Constructors:
    MUTEX_NORMAL : MutexType
    MUTEX_RECURSIVE : MutexType
    MUTEX_ERRORCHECK : MutexType

    Hints:
    EqMutexType
    FiniteMutexType
    OrdMutexType
    ShowMutexType
    dataCancelType : Type
    Totality: total
    Visibility: public export
    Constructors:
    CANCEL_DEFERRED : CancelType
    CANCEL_ASYNCHRONOUS : CancelType

    Hints:
    EqCancelType
    FiniteCancelType
    OrdCancelType
    ShowCancelType
    dataCancelState : Type
    Totality: total
    Visibility: public export
    Constructors:
    CANCEL_ENABLE : CancelState
    CANCEL_DISABLE : CancelState

    Hints:
    EqCancelState
    FiniteCancelState
    OrdCancelState
    ShowCancelState
    mutexCode : MutexType->Bits8
    Totality: total
    Visibility: public export
    cancelType : CancelType->Bits8
    Totality: total
    Visibility: public export
    cancelState : CancelState->Bits8
    Totality: total
    Visibility: public export
    pthread_t_size : Nat
    Totality: total
    Visibility: public export
    mutex_t_size : Nat
    Totality: total
    Visibility: public export
    cond_t_size : Nat
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Pthreads.Types

    (source)

    Definitions

    dataMutexType : Type
    Totality: total
    Visibility: public export
    Constructors:
    MUTEX_NORMAL : MutexType
    MUTEX_RECURSIVE : MutexType
    MUTEX_ERRORCHECK : MutexType

    Hints:
    EqMutexType
    FiniteMutexType
    OrdMutexType
    ShowMutexType
    dataCancelType : Type
    Totality: total
    Visibility: public export
    Constructors:
    CANCEL_DEFERRED : CancelType
    CANCEL_ASYNCHRONOUS : CancelType

    Hints:
    EqCancelType
    FiniteCancelType
    OrdCancelType
    ShowCancelType
    dataCancelState : Type
    Totality: total
    Visibility: public export
    Constructors:
    CANCEL_ENABLE : CancelState
    CANCEL_DISABLE : CancelState

    Hints:
    EqCancelState
    FiniteCancelState
    OrdCancelState
    ShowCancelState
    mutexCode : MutexType->Bits8
    Totality: total
    Visibility: public export
    cancelType : CancelType->Bits8
    Totality: total
    Visibility: public export
    cancelState : CancelState->Bits8
    Totality: total
    Visibility: public export
    pthread_t_size : Nat
    Totality: total
    Visibility: public export
    mutex_t_size : Nat
    Totality: total
    Visibility: public export
    cond_t_size : Nat
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Pthreads.html b/docs/posix/docs/docs/System.Posix.Pthreads.html index 9c7be6433..c0be56429 100644 --- a/docs/posix/docs/docs/System.Posix.Pthreads.html +++ b/docs/posix/docs/docs/System.Posix.Pthreads.html @@ -61,4 +61,4 @@ -

    System.Posix.Pthreads

    (source)

    Reexports

    importpublic Data.C.Ptr
    importpublic System.Posix.Errno
    importpublic System.Posix.Pthreads.Types

    Definitions

    recordPthreadT : Type
      Wrapper around an identifier for a POSIX thread.

    Totality: total
    Visibility: export
    Constructor: 
    P : AnyPtr->PthreadT

    Projection: 
    .ptr : PthreadT->AnyPtr

    Hints:
    EqPthreadT
    ShowPthreadT
    pthreadSelf : HasIOio=>ioPthreadT
      Returns the thread ID of the current thread.

    Totality: total
    Visibility: export
    pthreadJoin : PthreadT->IO (EitherErrno ())
      Blocks the current thread and waits for the given thread to terminate.

    Totality: total
    Visibility: export
    recordMutexT : Type
      Wrapper around a `pthread_mutex_t` pointer.

    Noted: While this provides additional flexibility over the type of mutex
    we use (see `mkmutex`) and how we acquire a lock on a mutex, it is less
    convenient to use than the garbage-collected version from
    `System.Concurrency`.

    Totality: total
    Visibility: export
    Constructor: 
    M : AnyPtr->MutexT

    Projection: 
    .ptr : MutexT->AnyPtr

    Hints:
    SizeOfMutexT
    StructMutexT
    mkmutex : MutexType->IO (EitherErrnoMutexT)
      Allocates and initializes a new mutex of the given type.

    This must be freed with `destroyMutex`.

    Totality: total
    Visibility: export
    destroyMutex : HasIOio=>MutexT->io ()
      Destroys a mutex and frees the memory allocated for it.

    Totality: total
    Visibility: export
    lockMutex : MutexT->IO (EitherErrno ())
      Tries to lock the given mutex, blocking the calling thread
    in case it is already locked.

    Totality: total
    Visibility: export
    timedlockMutex : MutexT->Timespec->IO (EitherErrno ())
    Totality: total
    Visibility: export
    trylockMutex : MutexT->IO (EitherErrno ())
      Like `lockMutex` but fails with `EBUSY` in case the mutex is
    already locked.

    Totality: total
    Visibility: export
    unlockMutex : MutexT->IO (EitherErrno ())
      Unlocks the given mutex.

    This is an error if the calling thread is not the one holding
    the mutex's lock.

    Totality: total
    Visibility: export
    recordCondT : Type
      Wrapper around a `pthread_cond_t` pointer.

    Noted: While this provides additional flexibility over the type of condition
    we use (see `mkcond`) convenient to use than the garbage-collected version from
    `System.Concurrency`.

    Totality: total
    Visibility: export
    Constructor: 
    C : AnyPtr->CondT

    Projection: 
    .ptr : CondT->AnyPtr

    Hints:
    SizeOfCondT
    StructCondT
    mkcond : IO (EitherErrnoCondT)
      Allocates and initializes a new condition variable.

    This must be freed with `destroyCond`.

    Totality: total
    Visibility: export
    destroyCond : HasIOio=>CondT->io ()
      Destroys a condition variable and frees the memory allocated for it.

    Totality: total
    Visibility: export
    condSignal : CondT->IO (EitherErrno ())
      Signals the given `pthread_cond_t`.

    If several threads are waiting on the condition, it is unspecified
    which of them will be signalled. We are only guaranteed that at least
    of them will be woken up.

    Totality: total
    Visibility: export
    condBroadcast : CondT->IO (EitherErrno ())
      Broadcasts the given `pthread_cond_t`.

    This will wake up all threads waiting on the given condition.

    Totality: total
    Visibility: export
    condWait : CondT->MutexT->IO (EitherErrno ())
      Blocks the given thread and waits for the given condition to
    be signalled.

    Note: The mutex must have been locked by the calling thread. The
    lock is automatically released upon calling `condWait`, and when
    the thread is woken up, the mutex will automatically be locked again.

    Totality: total
    Visibility: export
    condTimedwait : CondT->MutexT->Timespec->IO (EitherErrno ())
      Like `condWait` but will return with `ETIMEDOUT` after the given
    time interval expires.

    Totality: total
    Visibility: export
    pthreadCancel : PthreadT->IO (EitherErrno ())
      Sends a cancelation request to the given thread.

    Totality: total
    Visibility: export
    pthreadTestCancel : HasIOio=>io ()
      Tests for thread cancelation in the absence of other cancelation
    points.

    Totality: total
    Visibility: export
    setCancelType : HasIOio=>CancelType->ioCancelType
      Sets the current thread's cancel type returning the previous cancel type.

    Totality: total
    Visibility: export
    setCancelState : HasIOio=>CancelState->ioCancelState
      Sets the current thread's cancel state returning the previous cancel state.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Pthreads

    (source)

    Reexports

    importpublic Data.C.Ptr
    importpublic System.Posix.Errno
    importpublic System.Posix.Pthreads.Types

    Definitions

    recordPthreadT : Type
      Wrapper around an identifier for a POSIX thread.

    Totality: total
    Visibility: export
    Constructor: 
    P : AnyPtr->PthreadT

    Projection: 
    .ptr : PthreadT->AnyPtr

    Hints:
    EqPthreadT
    ShowPthreadT
    unwrapPthreadT : PthreadT->AnyPtr
    Totality: total
    Visibility: export
    pthreadSelf : HasIOio=>ioPthreadT
      Returns the thread ID of the current thread.

    Totality: total
    Visibility: export
    pthreadJoin : ErrIOio=>PthreadT->io ()
      Blocks the current thread and waits for the given thread to terminate.

    Totality: total
    Visibility: export
    recordMutexT : Type
      Wrapper around a `pthread_mutex_t` pointer.

    Noted: While this provides additional flexibility over the type of mutex
    we use (see `mkmutex`) and how we acquire a lock on a mutex, it is less
    convenient to use than the garbage-collected version from
    `System.Concurrency`.

    Totality: total
    Visibility: export
    Constructor: 
    M : AnyPtr->MutexT

    Projection: 
    .ptr : MutexT->AnyPtr

    Hints:
    SizeOfMutexT
    StructMutexT
    mkmutex : ErrIOio=>MutexType->ioMutexT
      Allocates and initializes a new mutex of the given type.

    This must be freed with `destroyMutex`.

    Totality: total
    Visibility: export
    destroyMutex : HasIOio=>MutexT->io ()
      Destroys a mutex and frees the memory allocated for it.

    Totality: total
    Visibility: export
    lockMutex : ErrIOio=>MutexT->io ()
      Tries to lock the given mutex, blocking the calling thread
    in case it is already locked.

    Totality: total
    Visibility: export
    timedlockMutex : ErrIOio=>MutexT->Timespec->io ()
    Totality: total
    Visibility: export
    trylockMutex : ErrIOio=>MutexT->io ()
      Like `lockMutex` but fails with `EBUSY` in case the mutex is
    already locked.

    Totality: total
    Visibility: export
    unlockMutex : ErrIOio=>MutexT->io ()
      Unlocks the given mutex.

    This is an error if the calling thread is not the one holding
    the mutex's lock.

    Totality: total
    Visibility: export
    recordCondT : Type
      Wrapper around a `pthread_cond_t` pointer.

    Noted: While this provides additional flexibility over the type of condition
    we use (see `mkcond`) convenient to use than the garbage-collected version from
    `System.Concurrency`.

    Totality: total
    Visibility: export
    Constructor: 
    C : AnyPtr->CondT

    Projection: 
    .ptr : CondT->AnyPtr

    Hints:
    SizeOfCondT
    StructCondT
    mkcond : ErrIOio=>ioCondT
      Allocates and initializes a new condition variable.

    This must be freed with `destroyCond`.

    Totality: total
    Visibility: export
    destroyCond : HasIOio=>CondT->io ()
      Destroys a condition variable and frees the memory allocated for it.

    Totality: total
    Visibility: export
    condSignal : ErrIOio=>CondT->io ()
      Signals the given `pthread_cond_t`.

    If several threads are waiting on the condition, it is unspecified
    which of them will be signalled. We are only guaranteed that at least
    of them will be woken up.

    Totality: total
    Visibility: export
    condBroadcast : ErrIOio=>CondT->io ()
      Broadcasts the given `pthread_cond_t`.

    This will wake up all threads waiting on the given condition.

    Totality: total
    Visibility: export
    condWait : ErrIOio=>CondT->MutexT->io ()
      Blocks the given thread and waits for the given condition to
    be signalled.

    Note: The mutex must have been locked by the calling thread. The
    lock is automatically released upon calling `condWait`, and when
    the thread is woken up, the mutex will automatically be locked again.

    Totality: total
    Visibility: export
    condTimedwait : ErrIOio=>CondT->MutexT->Timespec->io ()
      Like `condWait` but will return with `ETIMEDOUT` after the given
    time interval expires.

    Totality: total
    Visibility: export
    pthreadCancel : ErrIOio=>PthreadT->io ()
      Sends a cancelation request to the given thread.

    Totality: total
    Visibility: export
    pthreadTestCancel : HasIOio=>io ()
      Tests for thread cancelation in the absence of other cancelation
    points.

    Totality: total
    Visibility: export
    setCancelType : HasIOio=>CancelType->ioCancelType
      Sets the current thread's cancel type returning the previous cancel type.

    Totality: total
    Visibility: export
    setCancelState : HasIOio=>CancelState->ioCancelState
      Sets the current thread's cancel state returning the previous cancel state.

    Totality: total
    Visibility: export
    pthreadSigmask : HasIOio=>How->SigsetT->ioSigsetT
      Adjust the thread's signal mask according to the given `How`
    and signal set.

    Note: This allocates a new `sigset_t` pointer and returns the
    previously set signal mask. Client code is responsible to
    free the memory for this once it is no longer used.
    See also `pthreadSigmask'` for a version that does not return
    the previous signal mask.

    Totality: total
    Visibility: export
    pthreadSigmask' : HasIOio=>How->SigsetT->io ()
      Like `sigprocmask` but does not allocate a pointer for the
    previous `sigset_t`.

    Totality: total
    Visibility: export
    pthreadSiggetmask : HasIOio=>ioSigsetT
      Returns the current signal mask of the thread.

    Note: This allocates a new `sigset_t` pointer and returns the
    previously set signal mask. Client code is responsible to
    free the memory for this once it is no longer used.

    Totality: total
    Visibility: export
    pthreadKill : ErrIOio=>PthreadT->Signal->io ()
      Sends the given signal to the given thread.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Pthreads.src.html b/docs/posix/docs/docs/System.Posix.Pthreads.src.html index ff6458639..c643dbdea 100644 --- a/docs/posix/docs/docs/System.Posix.Pthreads.src.html +++ b/docs/posix/docs/docs/System.Posix.Pthreads.src.html @@ -123,276 +123,333 @@
      2 | import public Data.C.Ptr
      3 | import public System.Posix.Errno
      4 | import public System.Posix.Pthreads.Types
    -
      5 | import System.Posix.Time
    - -
      7 | %default total
    - -
      9 | --------------------------------------------------------------------------------
    -
     10 | -- FFI
    -
     11 | --------------------------------------------------------------------------------
    - -
     13 | %foreign "C:pthread_equal, posix-idris"
    -
     14 | prim__pthread_equal : AnyPtr -> AnyPtr -> Bits8
    - -
     16 | %foreign "C:pthread_self, posix-idris"
    -
     17 | prim__pthread_self : PrimIO AnyPtr
    - -
     19 | %foreign "C:li_pthread_join, posix-idris"
    -
     20 | prim__pthread_join : AnyPtr -> PrimIO Bits32
    - -
     22 | %foreign "C:li_pthread_mutex_init, posix-idris"
    -
     23 | prim__pthread_mutex_init : AnyPtr -> Bits8 -> PrimIO Bits32
    - -
     25 | %foreign "C:li_pthread_mutex_destroy, posix-idris"
    -
     26 | prim__pthread_mutex_destroy : AnyPtr -> PrimIO ()
    - -
     28 | %foreign "C:pthread_mutex_lock, posix-idris"
    -
     29 | prim__pthread_mutex_lock : AnyPtr -> PrimIO Bits32
    - -
     31 | %foreign "C:pthread_mutex_trylock, posix-idris"
    -
     32 | prim__pthread_mutex_trylock : AnyPtr -> PrimIO Bits32
    - -
     34 | %foreign "C:pthread_mutex_timedlock, posix-idris"
    -
     35 | prim__pthread_mutex_timedlock : AnyPtr -> AnyPtr -> PrimIO Bits32
    - -
     37 | %foreign "C:pthread_mutex_unlock, posix-idris"
    -
     38 | prim__pthread_mutex_unlock : AnyPtr -> PrimIO Bits32
    - -
     40 | %foreign "C:li_pthread_cond_init, posix-idris"
    -
     41 | prim__pthread_cond_init : AnyPtr -> PrimIO Bits32
    - -
     43 | %foreign "C:li_pthread_cond_destroy, posix-idris"
    -
     44 | prim__pthread_cond_destroy : AnyPtr -> PrimIO ()
    - -
     46 | %foreign "C:pthread_cond_signal, posix-idris"
    -
     47 | prim__pthread_cond_signal : AnyPtr -> PrimIO Bits32
    - -
     49 | %foreign "C:pthread_cond_broadcast, posix-idris"
    -
     50 | prim__pthread_cond_broadcast : AnyPtr -> PrimIO Bits32
    - -
     52 | %foreign "C:pthread_cond_wait, posix-idris"
    -
     53 | prim__pthread_cond_wait : AnyPtr -> AnyPtr -> PrimIO Bits32
    - -
     55 | %foreign "C:pthread_cond_timedwait, posix-idris"
    -
     56 | prim__pthread_cond_timedwait : AnyPtr -> AnyPtr -> AnyPtr -> PrimIO Bits32
    - -
     58 | %foreign "C:pthread_cancel, posix-idris"
    -
     59 | prim__pthread_cancel : AnyPtr -> PrimIO Bits32
    - -
     61 | %foreign "C:pthread_testcancel, posix-idris"
    -
     62 | prim__pthread_testcancel : PrimIO ()
    - -
     64 | %foreign "C:li_pthread_setcanceltype, posix-idris"
    -
     65 | prim__pthread_setcanceltype : Bits8 -> PrimIO Bits8
    - -
     67 | %foreign "C:li_pthread_setcancelstate, posix-idris"
    -
     68 | prim__pthread_setcancelstate : Bits8 -> PrimIO Bits8
    - -
     70 | --------------------------------------------------------------------------------
    -
     71 | -- API
    -
     72 | --------------------------------------------------------------------------------
    +
      5 | import System.Posix.Signal
    +
      6 | import System.Posix.Time
    + +
      8 | %default total
    + +
     10 | --------------------------------------------------------------------------------
    +
     11 | -- FFI
    +
     12 | --------------------------------------------------------------------------------
    + +
     14 | %foreign "C:pthread_equal, posix-idris"
    +
     15 | prim__pthread_equal : AnyPtr -> AnyPtr -> Bits8
    + +
     17 | %foreign "C:pthread_self, posix-idris"
    +
     18 | prim__pthread_self : PrimIO AnyPtr
    + +
     20 | %foreign "C:li_pthread_join, posix-idris"
    +
     21 | prim__pthread_join : AnyPtr -> PrimIO Bits32
    + +
     23 | %foreign "C:li_pthread_mutex_init, posix-idris"
    +
     24 | prim__pthread_mutex_init : AnyPtr -> Bits8 -> PrimIO Bits32
    + +
     26 | %foreign "C:li_pthread_mutex_destroy, posix-idris"
    +
     27 | prim__pthread_mutex_destroy : AnyPtr -> PrimIO ()
    + +
     29 | %foreign "C:pthread_mutex_lock, posix-idris"
    +
     30 | prim__pthread_mutex_lock : AnyPtr -> PrimIO Bits32
    + +
     32 | %foreign "C:pthread_mutex_trylock, posix-idris"
    +
     33 | prim__pthread_mutex_trylock : AnyPtr -> PrimIO Bits32
    + +
     35 | %foreign "C:pthread_mutex_timedlock, posix-idris"
    +
     36 | prim__pthread_mutex_timedlock : AnyPtr -> AnyPtr -> PrimIO Bits32
    + +
     38 | %foreign "C:pthread_mutex_unlock, posix-idris"
    +
     39 | prim__pthread_mutex_unlock : AnyPtr -> PrimIO Bits32
    + +
     41 | %foreign "C:li_pthread_cond_init, posix-idris"
    +
     42 | prim__pthread_cond_init : AnyPtr -> PrimIO Bits32
    + +
     44 | %foreign "C:li_pthread_cond_destroy, posix-idris"
    +
     45 | prim__pthread_cond_destroy : AnyPtr -> PrimIO ()
    + +
     47 | %foreign "C:pthread_cond_signal, posix-idris"
    +
     48 | prim__pthread_cond_signal : AnyPtr -> PrimIO Bits32
    + +
     50 | %foreign "C:pthread_cond_broadcast, posix-idris"
    +
     51 | prim__pthread_cond_broadcast : AnyPtr -> PrimIO Bits32
    + +
     53 | %foreign "C:pthread_cond_wait, posix-idris"
    +
     54 | prim__pthread_cond_wait : AnyPtr -> AnyPtr -> PrimIO Bits32
    + +
     56 | %foreign "C:pthread_cond_timedwait, posix-idris"
    +
     57 | prim__pthread_cond_timedwait : AnyPtr -> AnyPtr -> AnyPtr -> PrimIO Bits32
    + +
     59 | %foreign "C:pthread_cancel, posix-idris"
    +
     60 | prim__pthread_cancel : AnyPtr -> PrimIO Bits32
    + +
     62 | %foreign "C:pthread_testcancel, posix-idris"
    +
     63 | prim__pthread_testcancel : PrimIO ()
    + +
     65 | %foreign "C:li_pthread_setcanceltype, posix-idris"
    +
     66 | prim__pthread_setcanceltype : Bits8 -> PrimIO Bits8
    + +
     68 | %foreign "C:li_pthread_setcancelstate, posix-idris"
    +
     69 | prim__pthread_setcancelstate : Bits8 -> PrimIO Bits8
    + +
     71 | %foreign "C:li_pthread_sigmask1, posix-idris"
    +
     72 | prim__pthread_sigmask1 : Bits8 -> AnyPtr -> PrimIO ()
    -
     74 | ||| Wrapper around an identifier for a POSIX thread.
    -
     75 | export
    -
     76 | record PthreadT where
    -
     77 |   constructor P
    -
     78 |   ptr : AnyPtr
    +
     74 | %foreign "C:li_pthread_sigmask, posix-idris"
    +
     75 | prim__pthread_sigmask : Bits8 -> AnyPtr -> PrimIO AnyPtr
    + +
     77 | %foreign "C:li_pthread_siggetmask, posix-idris"
    +
     78 | prim__pthread_siggetmask : PrimIO AnyPtr
    -
     80 | ||| Returns the thread ID of the current thread.
    -
     81 | export %inline
    -
     82 | pthreadSelf : HasIO io => io PthreadT
    -
     83 | pthreadSelf = primIO $ primMap P $ prim__pthread_self
    - -
     85 | ||| Blocks the current thread and waits for the given thread to terminate.
    -
     86 | export %inline
    -
     87 | pthreadJoin : PthreadT -> IO (Either Errno ())
    -
     88 | pthreadJoin p = posToUnit $ prim__pthread_join p.ptr
    - -
     90 | export %inline
    -
     91 | Eq PthreadT where
    -
     92 |   x == y = toBool (prim__pthread_equal x.ptr y.ptr)
    - -
     94 | ||| Warning: This `Show` implementation for thread IDs is for debugging only!
    -
     95 | ||| According to SUSv3, a thread ID need not be a scalar, so it should be
    -
     96 | ||| treated as an opaque type.
    - -
     98 | ||| On many implementations (including on Linux), they are just integers, so
    -
     99 | ||| this can be useful for debugging.
    -
    100 | export %inline
    -
    101 | Show PthreadT where
    -
    102 |   show (P p) = show (believe_me {b = Bits64} p)
    - -
    104 | --------------------------------------------------------------------------------
    -
    105 | -- MutexT
    -
    106 | --------------------------------------------------------------------------------
    - -
    108 | ||| Wrapper around a `pthread_mutex_t` pointer.
    - -
    110 | ||| Noted: While this provides additional flexibility over the type of mutex
    -
    111 | ||| we use (see `mkmutex`) and how we acquire a lock on a mutex, it is less
    -
    112 | ||| convenient to use than the garbage-collected version from
    -
    113 | ||| `System.Concurrency`.
    -
    114 | export
    -
    115 | record MutexT where
    -
    116 |   constructor M
    -
    117 |   ptr : AnyPtr
    - -
    119 | %inline
    -
    120 | Struct MutexT where
    -
    121 |   unwrap = ptr
    -
    122 |   wrap   = M
    - -
    124 | %inline
    -
    125 | SizeOf MutexT where sizeof_ = mutex_t_size
    - -
    127 | ||| Allocates and initializes a new mutex of the given type.
    - -
    129 | ||| This must be freed with `destroyMutex`.
    -
    130 | export
    -
    131 | mkmutex : MutexType -> IO (Either Errno MutexT)
    -
    132 | mkmutex t = do
    -
    133 |   m <- allocStruct MutexT
    -
    134 |   e <- posToUnit $ prim__pthread_mutex_init m.ptr (mutexCode t)
    -
    135 |   case e of
    -
    136 |     Left x  => freeStruct m $> Left x
    -
    137 |     Right () => pure (Right m)
    - -
    139 | ||| Destroys a mutex and frees the memory allocated for it.
    -
    140 | export %inline
    -
    141 | destroyMutex : HasIO io => MutexT -> io ()
    -
    142 | destroyMutex m = primIO $ prim__pthread_mutex_destroy m.ptr
    +
     80 | %foreign "C:pthread_kill, posix-idris"
    +
     81 | prim__pthread_kill : AnyPtr -> Bits32 -> PrimIO Bits32
    + +
     83 | --------------------------------------------------------------------------------
    +
     84 | -- API
    +
     85 | --------------------------------------------------------------------------------
    + +
     87 | ||| Wrapper around an identifier for a POSIX thread.
    +
     88 | export
    +
     89 | record PthreadT where
    +
     90 |   constructor P
    +
     91 |   ptr : AnyPtr
    + +
     93 | export %inline
    +
     94 | unwrapPthreadT : PthreadT -> AnyPtr
    +
     95 | unwrapPthreadT = ptr
    + +
     97 | ||| Returns the thread ID of the current thread.
    +
     98 | export %inline
    +
     99 | pthreadSelf : HasIO io => io PthreadT
    +
    100 | pthreadSelf = primMap P $ prim__pthread_self
    + +
    102 | ||| Blocks the current thread and waits for the given thread to terminate.
    +
    103 | export %inline
    +
    104 | pthreadJoin : ErrIO io => PthreadT -> io ()
    +
    105 | pthreadJoin p = posToUnit $ prim__pthread_join p.ptr
    + +
    107 | export %inline
    +
    108 | Eq PthreadT where
    +
    109 |   x == y = toBool (prim__pthread_equal x.ptr y.ptr)
    + +
    111 | ||| Warning: This `Show` implementation for thread IDs is for debugging only!
    +
    112 | ||| According to SUSv3, a thread ID need not be a scalar, so it should be
    +
    113 | ||| treated as an opaque type.
    + +
    115 | ||| On many implementations (including on Linux), they are just integers, so
    +
    116 | ||| this can be useful for debugging.
    +
    117 | export %inline
    +
    118 | Show PthreadT where
    +
    119 |   show (P p) = show (believe_me {b = Bits64} p)
    + +
    121 | --------------------------------------------------------------------------------
    +
    122 | -- MutexT
    +
    123 | --------------------------------------------------------------------------------
    + +
    125 | ||| Wrapper around a `pthread_mutex_t` pointer.
    + +
    127 | ||| Noted: While this provides additional flexibility over the type of mutex
    +
    128 | ||| we use (see `mkmutex`) and how we acquire a lock on a mutex, it is less
    +
    129 | ||| convenient to use than the garbage-collected version from
    +
    130 | ||| `System.Concurrency`.
    +
    131 | export
    +
    132 | record MutexT where
    +
    133 |   constructor M
    +
    134 |   ptr : AnyPtr
    + +
    136 | %inline
    +
    137 | Struct MutexT where
    +
    138 |   unwrap = ptr
    +
    139 |   wrap   = M
    + +
    141 | %inline
    +
    142 | SizeOf MutexT where sizeof_ = mutex_t_size
    -
    144 | ||| Tries to lock the given mutex, blocking the calling thread
    -
    145 | ||| in case it is already locked.
    -
    146 | export %inline
    -
    147 | lockMutex : MutexT -> IO (Either Errno ())
    -
    148 | lockMutex p = posToUnit $ prim__pthread_mutex_lock p.ptr
    - -
    150 | export %inline
    -
    151 | timedlockMutex : MutexT -> Timespec -> IO (Either Errno ())
    -
    152 | timedlockMutex p t = posToUnit $ prim__pthread_mutex_timedlock p.ptr (unwrap t)
    - -
    154 | ||| Like `lockMutex` but fails with `EBUSY` in case the mutex is
    -
    155 | ||| already locked.
    -
    156 | export %inline
    -
    157 | trylockMutex : MutexT -> IO (Either Errno ())
    -
    158 | trylockMutex p = posToUnit $ prim__pthread_mutex_trylock p.ptr
    - -
    160 | ||| Unlocks the given mutex.
    - -
    162 | ||| This is an error if the calling thread is not the one holding
    -
    163 | ||| the mutex's lock.
    -
    164 | export %inline
    -
    165 | unlockMutex : MutexT -> IO (Either Errno ())
    -
    166 | unlockMutex p = posToUnit $ prim__pthread_mutex_unlock p.ptr
    - -
    168 | --------------------------------------------------------------------------------
    -
    169 | -- CondT
    -
    170 | --------------------------------------------------------------------------------
    - -
    172 | ||| Wrapper around a `pthread_cond_t` pointer.
    - -
    174 | ||| Noted: While this provides additional flexibility over the type of condition
    -
    175 | ||| we use (see `mkcond`) convenient to use than the garbage-collected version from
    -
    176 | ||| `System.Concurrency`.
    -
    177 | export
    -
    178 | record CondT where
    -
    179 |   constructor C
    -
    180 |   ptr : AnyPtr
    - -
    182 | %inline
    -
    183 | Struct CondT where
    -
    184 |   unwrap = ptr
    -
    185 |   wrap   = C
    - -
    187 | %inline
    -
    188 | SizeOf CondT where sizeof_ = cond_t_size
    - -
    190 | ||| Allocates and initializes a new condition variable.
    - -
    192 | ||| This must be freed with `destroyCond`.
    -
    193 | export
    -
    194 | mkcond : IO (Either Errno CondT)
    -
    195 | mkcond = do
    -
    196 |   m <- allocStruct CondT
    -
    197 |   e <- posToUnit $ prim__pthread_cond_init m.ptr
    -
    198 |   case e of
    -
    199 |     Left x   => freeStruct m $> Left x
    -
    200 |     Right () => pure (Right m)
    - -
    202 | ||| Destroys a condition variable and frees the memory allocated for it.
    -
    203 | export %inline
    -
    204 | destroyCond : HasIO io => CondT -> io ()
    -
    205 | destroyCond m = primIO $ prim__pthread_cond_destroy m.ptr
    +
    144 | ||| Allocates and initializes a new mutex of the given type.
    + +
    146 | ||| This must be freed with `destroyMutex`.
    +
    147 | export
    +
    148 | mkmutex : ErrIO io => MutexType -> io MutexT
    +
    149 | mkmutex t = do
    +
    150 |   m <- allocStruct MutexT
    +
    151 |   x <- primIO $ prim__pthread_mutex_init m.ptr (mutexCode t)
    +
    152 |   case x of
    +
    153 |     0 => pure m
    +
    154 |     x => freeStruct m >> error (EN x)
    + +
    156 | ||| Destroys a mutex and frees the memory allocated for it.
    +
    157 | export %inline
    +
    158 | destroyMutex : HasIO io => MutexT -> io ()
    +
    159 | destroyMutex m = primIO $ prim__pthread_mutex_destroy m.ptr
    + +
    161 | ||| Tries to lock the given mutex, blocking the calling thread
    +
    162 | ||| in case it is already locked.
    +
    163 | export %inline
    +
    164 | lockMutex : ErrIO io => MutexT -> io ()
    +
    165 | lockMutex p = posToUnit $ prim__pthread_mutex_lock p.ptr
    + +
    167 | export %inline
    +
    168 | timedlockMutex : ErrIO io => MutexT -> Timespec -> io ()
    +
    169 | timedlockMutex p t = posToUnit $ prim__pthread_mutex_timedlock p.ptr (unwrap t)
    + +
    171 | ||| Like `lockMutex` but fails with `EBUSY` in case the mutex is
    +
    172 | ||| already locked.
    +
    173 | export %inline
    +
    174 | trylockMutex : ErrIO io => MutexT -> io ()
    +
    175 | trylockMutex p = posToUnit $ prim__pthread_mutex_trylock p.ptr
    + +
    177 | ||| Unlocks the given mutex.
    + +
    179 | ||| This is an error if the calling thread is not the one holding
    +
    180 | ||| the mutex's lock.
    +
    181 | export %inline
    +
    182 | unlockMutex : ErrIO io => MutexT -> io ()
    +
    183 | unlockMutex p = posToUnit $ prim__pthread_mutex_unlock p.ptr
    + +
    185 | --------------------------------------------------------------------------------
    +
    186 | -- CondT
    +
    187 | --------------------------------------------------------------------------------
    + +
    189 | ||| Wrapper around a `pthread_cond_t` pointer.
    + +
    191 | ||| Noted: While this provides additional flexibility over the type of condition
    +
    192 | ||| we use (see `mkcond`) convenient to use than the garbage-collected version from
    +
    193 | ||| `System.Concurrency`.
    +
    194 | export
    +
    195 | record CondT where
    +
    196 |   constructor C
    +
    197 |   ptr : AnyPtr
    + +
    199 | %inline
    +
    200 | Struct CondT where
    +
    201 |   unwrap = ptr
    +
    202 |   wrap   = C
    + +
    204 | %inline
    +
    205 | SizeOf CondT where sizeof_ = cond_t_size
    -
    207 | ||| Signals the given `pthread_cond_t`.
    +
    207 | ||| Allocates and initializes a new condition variable.
    -
    209 | ||| If several threads are waiting on the condition, it is unspecified
    -
    210 | ||| which of them will be signalled. We are only guaranteed that at least
    -
    211 | ||| of them will be woken up.
    -
    212 | export %inline
    -
    213 | condSignal : CondT -> IO (Either Errno ())
    -
    214 | condSignal p = posToUnit $ prim__pthread_cond_signal p.ptr
    - -
    216 | ||| Broadcasts the given `pthread_cond_t`.
    - -
    218 | ||| This will wake up all threads waiting on the given condition.
    -
    219 | export %inline
    -
    220 | condBroadcast : CondT -> IO (Either Errno ())
    -
    221 | condBroadcast p = posToUnit $ prim__pthread_cond_broadcast p.ptr
    - -
    223 | ||| Blocks the given thread and waits for the given condition to
    -
    224 | ||| be signalled.
    +
    209 | ||| This must be freed with `destroyCond`.
    +
    210 | export
    +
    211 | mkcond : ErrIO io => io CondT
    +
    212 | mkcond = do
    +
    213 |   m <- allocStruct CondT
    +
    214 |   x <- primIO $ prim__pthread_cond_init m.ptr
    +
    215 |   case x of
    +
    216 |     0 => pure m
    +
    217 |     x => freeStruct m >> error (EN x)
    + +
    219 | ||| Destroys a condition variable and frees the memory allocated for it.
    +
    220 | export %inline
    +
    221 | destroyCond : HasIO io => CondT -> io ()
    +
    222 | destroyCond m = primIO $ prim__pthread_cond_destroy m.ptr
    + +
    224 | ||| Signals the given `pthread_cond_t`.
    -
    226 | ||| Note: The mutex must have been locked by the calling thread. The
    -
    227 | ||| lock is automatically released upon calling `condWait`, and when
    -
    228 | ||| the thread is woken up, the mutex will automatically be locked again.
    +
    226 | ||| If several threads are waiting on the condition, it is unspecified
    +
    227 | ||| which of them will be signalled. We are only guaranteed that at least
    +
    228 | ||| of them will be woken up.
    229 | export %inline
    -
    230 | condWait : CondT -> MutexT -> IO (Either Errno ())
    -
    231 | condWait p m = posToUnit $ prim__pthread_cond_wait p.ptr m.ptr
    +
    230 | condSignal : ErrIO io => CondT -> io ()
    +
    231 | condSignal p = posToUnit $ prim__pthread_cond_signal p.ptr
    -
    233 | ||| Like `condWait` but will return with `ETIMEDOUT` after the given
    -
    234 | ||| time interval expires.
    -
    235 | export %inline
    -
    236 | condTimedwait : CondT -> MutexT -> Timespec -> IO (Either Errno ())
    -
    237 | condTimedwait p m t =
    -
    238 |   posToUnit $ prim__pthread_cond_timedwait p.ptr m.ptr (unwrap t)
    +
    233 | ||| Broadcasts the given `pthread_cond_t`.
    + +
    235 | ||| This will wake up all threads waiting on the given condition.
    +
    236 | export %inline
    +
    237 | condBroadcast : ErrIO io => CondT -> io ()
    +
    238 | condBroadcast p = posToUnit $ prim__pthread_cond_broadcast p.ptr
    -
    240 | --------------------------------------------------------------------------------
    -
    241 | -- Thread Cancelation
    -
    242 | --------------------------------------------------------------------------------
    - -
    244 | toTpe : Bits8 -> CancelType
    -
    245 | toTpe b =
    -
    246 |   if b == cancelType CANCEL_DEFERRED then CANCEL_DEFERRED else CANCEL_ASYNCHRONOUS
    - -
    248 | toState : Bits8 -> CancelState
    -
    249 | toState b =
    -
    250 |   if b == cancelState CANCEL_ENABLE then CANCEL_ENABLE else CANCEL_DISABLE
    - -
    252 | ||| Sends a cancelation request to the given thread.
    -
    253 | export %inline
    -
    254 | pthreadCancel : PthreadT -> IO (Either Errno ())
    -
    255 | pthreadCancel t = posToUnit $ prim__pthread_cancel t.ptr
    +
    240 | ||| Blocks the given thread and waits for the given condition to
    +
    241 | ||| be signalled.
    + +
    243 | ||| Note: The mutex must have been locked by the calling thread. The
    +
    244 | ||| lock is automatically released upon calling `condWait`, and when
    +
    245 | ||| the thread is woken up, the mutex will automatically be locked again.
    +
    246 | export %inline
    +
    247 | condWait : ErrIO io => CondT -> MutexT -> io ()
    +
    248 | condWait p m = posToUnit $ prim__pthread_cond_wait p.ptr m.ptr
    + +
    250 | ||| Like `condWait` but will return with `ETIMEDOUT` after the given
    +
    251 | ||| time interval expires.
    +
    252 | export %inline
    +
    253 | condTimedwait : ErrIO io => CondT -> MutexT -> Timespec -> io ()
    +
    254 | condTimedwait p m t =
    +
    255 |   posToUnit $ prim__pthread_cond_timedwait p.ptr m.ptr (unwrap t)
    -
    257 | ||| Tests for thread cancelation in the absence of other cancelation
    -
    258 | ||| points.
    -
    259 | export %inline
    -
    260 | pthreadTestCancel : HasIO io => io ()
    -
    261 | pthreadTestCancel = primIO prim__pthread_testcancel
    - -
    263 | ||| Sets the current thread's cancel type returning the previous cancel type.
    -
    264 | export %inline
    -
    265 | setCancelType : HasIO io => CancelType -> io CancelType
    -
    266 | setCancelType t =
    -
    267 |   primIO $ primMap toTpe $ prim__pthread_setcanceltype (cancelType t)
    +
    257 | --------------------------------------------------------------------------------
    +
    258 | -- Thread Cancelation
    +
    259 | --------------------------------------------------------------------------------
    + +
    261 | toTpe : Bits8 -> CancelType
    +
    262 | toTpe b =
    +
    263 |   if b == cancelType CANCEL_DEFERRED then CANCEL_DEFERRED else CANCEL_ASYNCHRONOUS
    + +
    265 | toSt : Bits8 -> CancelState
    +
    266 | toSt b =
    +
    267 |   if b == cancelState CANCEL_ENABLE then CANCEL_ENABLE else CANCEL_DISABLE
    -
    269 | ||| Sets the current thread's cancel state returning the previous cancel state.
    +
    269 | ||| Sends a cancelation request to the given thread.
    270 | export %inline
    -
    271 | setCancelState : HasIO io => CancelState -> io CancelState
    -
    272 | setCancelState t =
    -
    273 |   primIO $ primMap toState $ prim__pthread_setcancelstate (cancelState t)
    - +
    271 | pthreadCancel : ErrIO io => PthreadT -> io ()
    +
    272 | pthreadCancel t = posToUnit $ prim__pthread_cancel t.ptr
    + +
    274 | ||| Tests for thread cancelation in the absence of other cancelation
    +
    275 | ||| points.
    +
    276 | export %inline
    +
    277 | pthreadTestCancel : HasIO io => io ()
    +
    278 | pthreadTestCancel = primIO prim__pthread_testcancel
    + +
    280 | ||| Sets the current thread's cancel type returning the previous cancel type.
    +
    281 | export %inline
    +
    282 | setCancelType : HasIO io => CancelType -> io CancelType
    +
    283 | setCancelType t = primMap toTpe $ prim__pthread_setcanceltype (cancelType t)
    + +
    285 | ||| Sets the current thread's cancel state returning the previous cancel state.
    +
    286 | export %inline
    +
    287 | setCancelState : HasIO io => CancelState -> io CancelState
    +
    288 | setCancelState t = primMap toSt $ prim__pthread_setcancelstate (cancelState t)
    + +
    290 | --------------------------------------------------------------------------------
    +
    291 | -- Signals and Threads
    +
    292 | --------------------------------------------------------------------------------
    + +
    294 | ||| Adjust the thread's signal mask according to the given `How`
    +
    295 | ||| and signal set.
    + +
    297 | ||| Note: This allocates a new `sigset_t` pointer and returns the
    +
    298 | |||       previously set signal mask. Client code is responsible to
    +
    299 | |||       free the memory for this once it is no longer used.
    +
    300 | |||       See also `pthreadSigmask'` for a version that does not return
    +
    301 | |||       the previous signal mask.
    +
    302 | export %inline
    +
    303 | pthreadSigmask : HasIO io => How -> SigsetT -> io SigsetT
    +
    304 | pthreadSigmask h p =
    +
    305 |   primIO $ \w =>
    +
    306 |     let MkIORes p2 w := prim__pthread_sigmask (howCode h) (unwrap p) w
    +
    307 |      in MkIORes (wrap p2) w
    + +
    309 | ||| Like `sigprocmask` but does not allocate a pointer for the
    +
    310 | ||| previous `sigset_t`.
    +
    311 | export %inline
    +
    312 | pthreadSigmask' : HasIO io => How -> SigsetT -> io ()
    +
    313 | pthreadSigmask' h p = primIO $ prim__pthread_sigmask1 (howCode h) (unwrap p)
    + +
    315 | ||| Returns the current signal mask of the thread.
    + +
    317 | ||| Note: This allocates a new `sigset_t` pointer and returns the
    +
    318 | |||       previously set signal mask. Client code is responsible to
    +
    319 | |||       free the memory for this once it is no longer used.
    +
    320 | export %inline
    +
    321 | pthreadSiggetmask : HasIO io => io SigsetT
    +
    322 | pthreadSiggetmask =
    +
    323 |   primIO $ \w =>
    +
    324 |     let MkIORes p w := prim__pthread_siggetmask w
    +
    325 |      in MkIORes (wrap p) w
    + +
    327 | ||| Sends the given signal to the given thread.
    +
    328 | export %inline
    +
    329 | pthreadKill : ErrIO io => PthreadT -> Signal -> io ()
    +
    330 | pthreadKill t s = posToUnit $ prim__pthread_kill t.ptr s.sig
    + diff --git a/docs/posix/docs/docs/System.Posix.Signal.Types.html b/docs/posix/docs/docs/System.Posix.Signal.Types.html index 24b5020d5..4e3c132ab 100644 --- a/docs/posix/docs/docs/System.Posix.Signal.Types.html +++ b/docs/posix/docs/docs/System.Posix.Signal.Types.html @@ -61,4 +61,4 @@ -

    System.Posix.Signal.Types

    (source)

    Definitions

    dataHow : Type
    Totality: total
    Visibility: public export
    Constructors:
    SIG_BLOCK : How
    SIG_UNBLOCK : How
    SIG_SETMASK : How

    Hints:
    EqHow
    OrdHow
    ShowHow
    recordSignal : Type
    Totality: total
    Visibility: public export
    Constructor: 
    S : Bits32->Signal

    Projection: 
    .sig : Signal->Bits32

    Hints:
    EqSignal
    OrdSignal
    ShowSignal
    .sig : Signal->Bits32
    Totality: total
    Visibility: public export
    sig : Signal->Bits32
    Totality: total
    Visibility: public export
    howCode : How->Bits8
    Totality: total
    Visibility: public export
    SIGRTMIN : Signal
    Totality: total
    Visibility: public export
    SIGRTMAX : Signal
    Totality: total
    Visibility: public export
    SIGHUP : Signal
    Totality: total
    Visibility: public export
    SIGINT : Signal
    Totality: total
    Visibility: public export
    SIGQUIT : Signal
    Totality: total
    Visibility: public export
    SIGILL : Signal
    Totality: total
    Visibility: public export
    SIGTRAP : Signal
    Totality: total
    Visibility: public export
    SIGABRT : Signal
    Totality: total
    Visibility: public export
    SIGBUS : Signal
    Totality: total
    Visibility: public export
    SIGFPE : Signal
    Totality: total
    Visibility: public export
    SIGKILL : Signal
    Totality: total
    Visibility: public export
    SIGUSR1 : Signal
    Totality: total
    Visibility: public export
    SIGSEGV : Signal
    Totality: total
    Visibility: public export
    SIGUSR2 : Signal
    Totality: total
    Visibility: public export
    SIGPIPE : Signal
    Totality: total
    Visibility: public export
    SIGALRM : Signal
    Totality: total
    Visibility: public export
    SIGTERM : Signal
    Totality: total
    Visibility: public export
    SIGCHLD : Signal
    Totality: total
    Visibility: public export
    SIGCONT : Signal
    Totality: total
    Visibility: public export
    SIGSTOP : Signal
    Totality: total
    Visibility: public export
    SIGTSTP : Signal
    Totality: total
    Visibility: public export
    SIGTTIN : Signal
    Totality: total
    Visibility: public export
    SIGTTOU : Signal
    Totality: total
    Visibility: public export
    SIGURG : Signal
    Totality: total
    Visibility: public export
    SIGXCPU : Signal
    Totality: total
    Visibility: public export
    SIGXFSZ : Signal
    Totality: total
    Visibility: public export
    SIGVTALRM : Signal
    Totality: total
    Visibility: public export
    SIGPROF : Signal
    Totality: total
    Visibility: public export
    SIGPOLL : Signal
    Totality: total
    Visibility: public export
    SIGSYS : Signal
    Totality: total
    Visibility: public export
    sigName : SortedMapSignalString
    Totality: total
    Visibility: export
    siginfo_t_size : Nat
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Signal.Types

    (source)

    Definitions

    dataHow : Type
    Totality: total
    Visibility: public export
    Constructors:
    SIG_BLOCK : How
    SIG_UNBLOCK : How
    SIG_SETMASK : How

    Hints:
    EqHow
    OrdHow
    ShowHow
    recordSignal : Type
    Totality: total
    Visibility: public export
    Constructor: 
    S : Bits32->Signal

    Projection: 
    .sig : Signal->Bits32

    Hints:
    EqSignal
    OrdSignal
    ShowSignal
    .sig : Signal->Bits32
    Totality: total
    Visibility: public export
    sig : Signal->Bits32
    Totality: total
    Visibility: public export
    howCode : How->Bits8
    Totality: total
    Visibility: public export
    SIGRTMIN : Signal
    Totality: total
    Visibility: public export
    SIGRTMAX : Signal
    Totality: total
    Visibility: public export
    SIGHUP : Signal
    Totality: total
    Visibility: public export
    SIGINT : Signal
    Totality: total
    Visibility: public export
    SIGQUIT : Signal
    Totality: total
    Visibility: public export
    SIGILL : Signal
    Totality: total
    Visibility: public export
    SIGTRAP : Signal
    Totality: total
    Visibility: public export
    SIGABRT : Signal
    Totality: total
    Visibility: public export
    SIGBUS : Signal
    Totality: total
    Visibility: public export
    SIGFPE : Signal
    Totality: total
    Visibility: public export
    SIGKILL : Signal
    Totality: total
    Visibility: public export
    SIGUSR1 : Signal
    Totality: total
    Visibility: public export
    SIGSEGV : Signal
    Totality: total
    Visibility: public export
    SIGUSR2 : Signal
    Totality: total
    Visibility: public export
    SIGPIPE : Signal
    Totality: total
    Visibility: public export
    SIGALRM : Signal
    Totality: total
    Visibility: public export
    SIGTERM : Signal
    Totality: total
    Visibility: public export
    SIGCHLD : Signal
    Totality: total
    Visibility: public export
    SIGCONT : Signal
    Totality: total
    Visibility: public export
    SIGSTOP : Signal
    Totality: total
    Visibility: public export
    SIGTSTP : Signal
    Totality: total
    Visibility: public export
    SIGTTIN : Signal
    Totality: total
    Visibility: public export
    SIGTTOU : Signal
    Totality: total
    Visibility: public export
    SIGURG : Signal
    Totality: total
    Visibility: public export
    SIGXCPU : Signal
    Totality: total
    Visibility: public export
    SIGXFSZ : Signal
    Totality: total
    Visibility: public export
    SIGVTALRM : Signal
    Totality: total
    Visibility: public export
    SIGPROF : Signal
    Totality: total
    Visibility: public export
    SIGPOLL : Signal
    Totality: total
    Visibility: public export
    SIGSYS : Signal
    Totality: total
    Visibility: public export
    sigName : SortedMapSignalString
    Totality: total
    Visibility: export
    siginfo_t_size : Nat
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Signal.html b/docs/posix/docs/docs/System.Posix.Signal.html index f77b51301..d1a355a5e 100644 --- a/docs/posix/docs/docs/System.Posix.Signal.html +++ b/docs/posix/docs/docs/System.Posix.Signal.html @@ -61,4 +61,4 @@ -

    System.Posix.Signal

    (source)

    Reexports

    importpublic Data.C.Integer
    importpublic Data.C.Struct
    importpublic System.Posix.Errno
    importpublic System.Posix.Signal.Types

    Definitions

    get_siginfo_t_si_signo : AnyPtr->PrimIOBits32
    get_siginfo_t_si_code : AnyPtr->PrimIOCInt
    get_siginfo_t_si_pid : AnyPtr->PrimIOPidT
    get_siginfo_t_si_uid : AnyPtr->PrimIOUidT
    get_siginfo_t_si_status : AnyPtr->PrimIOCInt
    get_siginfo_t_si_value : AnyPtr->PrimIOCInt
    recordSigsetT : Type
      Wrapper around a pointer of a signal set (`sigset_t`).

    Totality: total
    Visibility: export
    Constructor: 
    S : AnyPtr->SigsetT

    Projection: 
    .ptr : SigsetT->AnyPtr

    Hint: 
    StructSigsetT
    emptySigset : HasIOio=>ioSigsetT
      Allocates a `sigset_t` with all signals cleared.

    This must be freed with `freeSigset`.

    Totality: total
    Visibility: export
    fullSigset : HasIOio=>ioSigsetT
      Allocates a `sigset_t` with all signals set.

    This must be freed with `freeSigset`.

    Totality: total
    Visibility: export
    sigaddset : HasIOio=>SigsetT->Signal->io ()
      Adds a signal to a `sigset_t`

    Totality: total
    Visibility: export
    sigdelset : HasIOio=>SigsetT->Signal->io ()
      Removes a signal from a `sigset_t`

    Totality: total
    Visibility: export
    sigismember : HasIOio=>SigsetT->Signal->ioBool
      Tests if a signal is a member of a `sigset_t`.

    Totality: total
    Visibility: export
    kill : PidT->Signal->IO (EitherErrno ())
      Sends a signal to a running process or a group of processes.

    Totality: total
    Visibility: export
    raise : Signal->IO ()
      Sends a signal to the calling thread.

    Totality: total
    Visibility: export
    sigqueue : PidT->Signal->CInt->IO (EitherErrno ())
      Sends a realtime signal plus data word to a running process.

    Note that `sig` must be in the range [SIGRTMIN, SIGRTMAX].

    Totality: total
    Visibility: export
    sigprocmask : HasIOio=>How->SigsetT->ioSigsetT
      Adjust the process signal mask according to the given `How`
    and signal set.

    Note: This allocates a new `sigset_t` pointer and returns the
    previously set signal mask. Client code is responsible to
    free the memory for this once it is no longer used.
    See also `sigprocmask'` for a version that does not return
    the previous signal mask.

    Totality: total
    Visibility: export
    sigprocmask' : HasIOio=>How->SigsetT->io ()
      Like `sigprocmask` but does not allocate a pointer for the
    previous `sigset_t`.

    Totality: total
    Visibility: export
    siggetprocmask : HasIOio=>ioSigsetT
      Returns the current signal mask of the process.

    Note: This allocates a new `sigset_t` pointer and returns the
    previously set signal mask. Client code is responsible to
    free the memory for this once it is no longer used.

    Totality: total
    Visibility: export
    sigpending : HasIOio=>ioSigsetT
      Returns the set of currently pending signals.

    Note: This allocates a new `sigset_t` pointer and returns the
    previously set signal mask. Client code is responsible to
    free the memory for this once it is no longer used.

    Totality: total
    Visibility: export
    abort : HasIOio=>io ()
      Terminates the application by raising `SIGABRT` and dumps core.

    While `SIGABRT` can be handled with a signal handler, `abort` is
    still guaranteed successfully terminate the process.

    Totality: total
    Visibility: export
    pause : IO (EitherErrno ())
      Suspends the current thread until a non-blocked signal is encountered.

    Totality: total
    Visibility: export
    recordSiginfoT : Type
    Totality: total
    Visibility: export
    Constructor: 
    ST : AnyPtr->SiginfoT

    Projection: 
    .ptr : SiginfoT->AnyPtr

    Hints:
    SizeOfSiginfoT
    StructSiginfoT
    signal : HasIOio=>SiginfoT->ioSignal
    Totality: total
    Visibility: export
    code : HasIOio=>SiginfoT->ioCInt
    Totality: total
    Visibility: export
    pid : HasIOio=>SiginfoT->ioPidT
    Totality: total
    Visibility: export
    uid : HasIOio=>SiginfoT->ioUidT
    Totality: total
    Visibility: export
    status : HasIOio=>SiginfoT->ioCInt
    Totality: total
    Visibility: export
    value : HasIOio=>SiginfoT->ioCInt
    Totality: total
    Visibility: export
    sigsuspend : SigsetT->IO (EitherErrno ())
      Atomically blocks the signals in `set`, then
    pauses the thread (see `pause`) and restores the signal set
    afterwards.

    Totality: total
    Visibility: export
    sigwaitinfo : SigsetT->SiginfoT->IO (EitherErrno ())
      Synchronously awaits one of the signals in `set`.

    Note: Usually, the signals in `set` should first be blocked via
    `sigprocmask`.

    Totality: total
    Visibility: export
    sigtimedwait : SigsetT->SiginfoT->TimeT->NsecT->IO (EitherErrno ())
      Like `sigwaitinfo` but times out with `EAGAIN` after `sec` seconds and
    `nsec` nanoseconds.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Signal

    (source)

    Reexports

    importpublic Data.C.Integer
    importpublic Data.C.Struct
    importpublic System.Posix.Errno
    importpublic System.Posix.Signal.Types

    Definitions

    get_siginfo_t_si_signo : AnyPtr->PrimIOBits32
    get_siginfo_t_si_code : AnyPtr->PrimIOCInt
    get_siginfo_t_si_pid : AnyPtr->PrimIOPidT
    get_siginfo_t_si_uid : AnyPtr->PrimIOUidT
    get_siginfo_t_si_status : AnyPtr->PrimIOCInt
    get_siginfo_t_si_value : AnyPtr->PrimIOCInt
    recordSigsetT : Type
      Wrapper around a pointer of a signal set (`sigset_t`).

    Totality: total
    Visibility: export
    Constructor: 
    S : AnyPtr->SigsetT

    Projection: 
    .ptr : SigsetT->AnyPtr

    Hint: 
    StructSigsetT
    emptySigset : HasIOio=>ioSigsetT
      Allocates a `sigset_t` with all signals cleared.

    This must be freed with `freeSigset`.

    Totality: total
    Visibility: export
    fullSigset : HasIOio=>ioSigsetT
      Allocates a `sigset_t` with all signals set.

    This must be freed with `freeSigset`.

    Totality: total
    Visibility: export
    sigaddset : HasIOio=>SigsetT->Signal->io ()
      Adds a signal to a `sigset_t`

    Totality: total
    Visibility: export
    sigdelset : HasIOio=>SigsetT->Signal->io ()
      Removes a signal from a `sigset_t`

    Totality: total
    Visibility: export
    sigismember : HasIOio=>SigsetT->Signal->ioBool
      Tests if a signal is a member of a `sigset_t`.

    Totality: total
    Visibility: export
    kill : ErrIOio=>PidT->Signal->io ()
      Sends a signal to a running process or a group of processes.

    Totality: total
    Visibility: export
    raise : HasIOio=>Signal->io ()
      Sends a signal to the calling thread.

    Totality: total
    Visibility: export
    sigqueue : ErrIOio=>PidT->Signal->CInt->io ()
      Sends a realtime signal plus data word to a running process.

    Note that `sig` must be in the range [SIGRTMIN, SIGRTMAX].

    Totality: total
    Visibility: export
    sigprocmask : HasIOio=>How->SigsetT->ioSigsetT
      Adjust the process signal mask according to the given `How`
    and signal set.

    Note: This allocates a new `sigset_t` pointer and returns the
    previously set signal mask. Client code is responsible to
    free the memory for this once it is no longer used.
    See also `sigprocmask'` for a version that does not return
    the previous signal mask.

    Totality: total
    Visibility: export
    sigprocmask' : HasIOio=>How->SigsetT->io ()
      Like `sigprocmask` but does not allocate a pointer for the
    previous `sigset_t`.

    Totality: total
    Visibility: export
    siggetprocmask : HasIOio=>ioSigsetT
      Returns the current signal mask of the process.

    Note: This allocates a new `sigset_t` pointer and returns the
    previously set signal mask. Client code is responsible to
    free the memory for this once it is no longer used.

    Totality: total
    Visibility: export
    sigpending : HasIOio=>ioSigsetT
      Returns the set of currently pending signals.

    Note: This allocates a new `sigset_t` pointer and returns the
    previously set signal mask. Client code is responsible to
    free the memory for this once it is no longer used.

    Totality: total
    Visibility: export
    abort : HasIOio=>io ()
      Terminates the application by raising `SIGABRT` and dumps core.

    While `SIGABRT` can be handled with a signal handler, `abort` is
    still guaranteed successfully terminate the process.

    Totality: total
    Visibility: export
    pause : ErrIOio=>io ()
      Suspends the current thread until a non-blocked signal is encountered.

    Totality: total
    Visibility: export
    recordSiginfoT : Type
    Totality: total
    Visibility: export
    Constructor: 
    ST : AnyPtr->SiginfoT

    Projection: 
    .ptr : SiginfoT->AnyPtr

    Hints:
    SizeOfSiginfoT
    StructSiginfoT
    signal : HasIOio=>SiginfoT->ioSignal
    Totality: total
    Visibility: export
    code : HasIOio=>SiginfoT->ioCInt
    Totality: total
    Visibility: export
    pid : HasIOio=>SiginfoT->ioPidT
    Totality: total
    Visibility: export
    uid : HasIOio=>SiginfoT->ioUidT
    Totality: total
    Visibility: export
    status : HasIOio=>SiginfoT->ioCInt
    Totality: total
    Visibility: export
    value : HasIOio=>SiginfoT->ioCInt
    Totality: total
    Visibility: export
    sigsuspend : ErrIOio=>SigsetT->io ()
      Atomically blocks the signals in `set`, then
    pauses the thread (see `pause`) and restores the signal set
    afterwards.

    Totality: total
    Visibility: export
    sigwaitinfo : ErrIOio=>SigsetT->SiginfoT->io ()
      Synchronously awaits one of the signals in `set`.

    Note: Usually, the signals in `set` should first be blocked via
    `sigprocmask`.

    Totality: total
    Visibility: export
    sigwait : ErrIOio=>SigsetT->ioSignal
      Synchronously awaits one of the signals in `set`.

    This is like `sigwaitinfo` but with a simpler API.

    Totality: total
    Visibility: export
    sigtimedwait : ErrIOio=>SigsetT->SiginfoT->TimeT->NsecT->io ()
      Like `sigwaitinfo` but times out with `EAGAIN` after `sec` seconds and
    `nsec` nanoseconds.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Signal.src.html b/docs/posix/docs/docs/System.Posix.Signal.src.html index 8c60dffc7..589e47935 100644 --- a/docs/posix/docs/docs/System.Posix.Signal.src.html +++ b/docs/posix/docs/docs/System.Posix.Signal.src.html @@ -184,228 +184,237 @@
     63 | %foreign "C:li_sigtimedwait, posix-idris"
     64 | prim__sigtimedwait : AnyPtr -> AnyPtr -> TimeT -> NsecT -> PrimIO CInt
    -
     66 | export %foreign "C:get_siginfo_t_si_signo, posix-idris"
    -
     67 | get_siginfo_t_si_signo: AnyPtr -> PrimIO Bits32
    +
     66 | %foreign "C:li_sigwait, posix-idris"
    +
     67 | prim__sigwait : AnyPtr -> PrimIO CInt
    -
     69 | export %foreign "C:get_siginfo_t_si_code, posix-idris"
    -
     70 | get_siginfo_t_si_code: AnyPtr -> PrimIO CInt
    +
     69 | export %foreign "C:get_siginfo_t_si_signo, posix-idris"
    +
     70 | get_siginfo_t_si_signo: AnyPtr -> PrimIO Bits32
    -
     72 | export %foreign "C:get_siginfo_t_si_pid, posix-idris"
    -
     73 | get_siginfo_t_si_pid: AnyPtr -> PrimIO PidT
    +
     72 | export %foreign "C:get_siginfo_t_si_code, posix-idris"
    +
     73 | get_siginfo_t_si_code: AnyPtr -> PrimIO CInt
    -
     75 | export %foreign "C:get_siginfo_t_si_uid, posix-idris"
    -
     76 | get_siginfo_t_si_uid: AnyPtr -> PrimIO UidT
    +
     75 | export %foreign "C:get_siginfo_t_si_pid, posix-idris"
    +
     76 | get_siginfo_t_si_pid: AnyPtr -> PrimIO PidT
    -
     78 | export %foreign "C:get_siginfo_t_si_status, posix-idris"
    -
     79 | get_siginfo_t_si_status: AnyPtr -> PrimIO CInt
    +
     78 | export %foreign "C:get_siginfo_t_si_uid, posix-idris"
    +
     79 | get_siginfo_t_si_uid: AnyPtr -> PrimIO UidT
    -
     81 | export %foreign "C:get_siginfo_t_si_value, posix-idris"
    -
     82 | get_siginfo_t_si_value: AnyPtr -> PrimIO CInt
    +
     81 | export %foreign "C:get_siginfo_t_si_status, posix-idris"
    +
     82 | get_siginfo_t_si_status: AnyPtr -> PrimIO CInt
    -
     84 | --------------------------------------------------------------------------------
    -
     85 | -- Signal Sets
    -
     86 | --------------------------------------------------------------------------------
    - -
     88 | ||| Wrapper around a pointer of a signal set (`sigset_t`).
    -
     89 | export
    -
     90 | record SigsetT where
    -
     91 |   constructor S
    -
     92 |   ptr : AnyPtr
    - -
     94 | export %inline
    -
     95 | Struct SigsetT where
    -
     96 |   wrap   = S
    -
     97 |   unwrap = ptr
    - -
     99 | ||| Allocates a `sigset_t` with all signals cleared.
    - -
    101 | ||| This must be freed with `freeSigset`.
    -
    102 | export %inline
    -
    103 | emptySigset : HasIO io => io SigsetT
    -
    104 | emptySigset =
    -
    105 |   primIO $ \w => let MkIORes p w := prim__emptysigset w in MkIORes (S p) w
    - -
    107 | ||| Allocates a `sigset_t` with all signals set.
    - -
    109 | ||| This must be freed with `freeSigset`.
    -
    110 | export %inline
    -
    111 | fullSigset : HasIO io => io SigsetT
    -
    112 | fullSigset =
    -
    113 |   primIO $ \w => let MkIORes p w := prim__fullsigset w in MkIORes (S p) w
    - -
    115 | ||| Adds a signal to a `sigset_t`
    -
    116 | export %inline
    -
    117 | sigaddset : HasIO io => SigsetT -> Signal -> io ()
    -
    118 | sigaddset (S p) s = primIO $ prim__sigaddset p s.sig
    - -
    120 | ||| Removes a signal from a `sigset_t`
    -
    121 | export %inline
    -
    122 | sigdelset : HasIO io => SigsetT -> Signal -> io ()
    -
    123 | sigdelset (S p) s = primIO $ prim__sigdelset p s.sig
    - -
    125 | ||| Tests if a signal is a member of a `sigset_t`.
    -
    126 | export %inline
    -
    127 | sigismember : HasIO io => SigsetT -> Signal -> io Bool
    -
    128 | sigismember (S p) s =
    -
    129 |   primIO $ \w =>
    -
    130 |     let MkIORes r w := prim__sigismember p s.sig w
    -
    131 |      in case r of
    -
    132 |           0 => MkIORes False w
    -
    133 |           _ => MkIORes True w
    - -
    135 | --------------------------------------------------------------------------------
    -
    136 | -- API
    -
    137 | --------------------------------------------------------------------------------
    - -
    139 | ||| Sends a signal to a running process or a group of processes.
    -
    140 | export %inline
    -
    141 | kill : PidT -> Signal -> IO (Either Errno ())
    -
    142 | kill p s = toUnit $ prim__kill p s.sig
    - -
    144 | ||| Sends a signal to the calling thread.
    -
    145 | export %inline
    -
    146 | raise : Signal -> IO ()
    -
    147 | raise s = fromPrim $ prim__raise s.sig
    - -
    149 | ||| Sends a realtime signal plus data word to a running process.
    - -
    151 | ||| Note that `sig` must be in the range [SIGRTMIN, SIGRTMAX].
    -
    152 | export %inline
    -
    153 | sigqueue : PidT -> Signal -> (word : CInt) -> IO (Either Errno ())
    -
    154 | sigqueue p s word = toUnit $ prim__sigqueue p s.sig word
    - -
    156 | ||| Adjust the process signal mask according to the given `How`
    -
    157 | ||| and signal set.
    - -
    159 | ||| Note: This allocates a new `sigset_t` pointer and returns the
    -
    160 | |||       previously set signal mask. Client code is responsible to
    -
    161 | |||       free the memory for this once it is no longer used.
    -
    162 | |||       See also `sigprocmask'` for a version that does not return
    -
    163 | |||       the previous signal mask.
    -
    164 | export %inline
    -
    165 | sigprocmask : HasIO io => How -> SigsetT -> io SigsetT
    -
    166 | sigprocmask h (S p) =
    -
    167 |   primIO $ \w =>
    -
    168 |     let MkIORes p2 w := prim__sigprocmask (howCode h) p w
    -
    169 |      in MkIORes (S p2) w
    - -
    171 | ||| Like `sigprocmask` but does not allocate a pointer for the
    -
    172 | ||| previous `sigset_t`.
    -
    173 | export %inline
    -
    174 | sigprocmask' : HasIO io => How -> SigsetT -> io ()
    -
    175 | sigprocmask' h (S p) = primIO $ prim__sigprocmask1 (howCode h) p
    - -
    177 | ||| Returns the current signal mask of the process.
    - -
    179 | ||| Note: This allocates a new `sigset_t` pointer and returns the
    -
    180 | |||       previously set signal mask. Client code is responsible to
    -
    181 | |||       free the memory for this once it is no longer used.
    -
    182 | export %inline
    -
    183 | siggetprocmask : HasIO io => io SigsetT
    -
    184 | siggetprocmask =
    -
    185 |   primIO $ \w =>
    -
    186 |     let MkIORes p w := prim__siggetprocmask w
    -
    187 |      in MkIORes (S p) w
    - -
    189 | ||| Returns the set of currently pending signals.
    - -
    191 | ||| Note: This allocates a new `sigset_t` pointer and returns the
    -
    192 | |||       previously set signal mask. Client code is responsible to
    -
    193 | |||       free the memory for this once it is no longer used.
    -
    194 | export %inline
    -
    195 | sigpending : HasIO io => io SigsetT
    -
    196 | sigpending =
    -
    197 |   primIO $ \w =>
    -
    198 |     let MkIORes p w := prim__sigpending w
    -
    199 |      in MkIORes (S p) w
    - -
    201 | ||| Terminates the application by raising `SIGABRT` and dumps core.
    - -
    203 | ||| While `SIGABRT` can be handled with a signal handler, `abort` is
    -
    204 | ||| still guaranteed successfully terminate the process.
    -
    205 | export %inline
    -
    206 | abort : HasIO io => io ()
    -
    207 | abort = primIO prim__abort
    - -
    209 | ||| Suspends the current thread until a non-blocked signal is encountered.
    -
    210 | export %inline
    -
    211 | pause : IO (Either Errno ())
    -
    212 | pause =
    -
    213 |   toUnit prim__pause >>= \case
    -
    214 |     Left EINTR => pure $ Right () -- this is the normal case
    -
    215 |     x          => pure x
    - -
    217 | --------------------------------------------------------------------------------
    -
    218 | -- Synchronous Signal Handling
    +
     84 | export %foreign "C:get_siginfo_t_si_value, posix-idris"
    +
     85 | get_siginfo_t_si_value: AnyPtr -> PrimIO CInt
    + +
     87 | --------------------------------------------------------------------------------
    +
     88 | -- Signal Sets
    +
     89 | --------------------------------------------------------------------------------
    + +
     91 | ||| Wrapper around a pointer of a signal set (`sigset_t`).
    +
     92 | export
    +
     93 | record SigsetT where
    +
     94 |   constructor S
    +
     95 |   ptr : AnyPtr
    + +
     97 | export %inline
    +
     98 | Struct SigsetT where
    +
     99 |   wrap   = S
    +
    100 |   unwrap = ptr
    + +
    102 | ||| Allocates a `sigset_t` with all signals cleared.
    + +
    104 | ||| This must be freed with `freeSigset`.
    +
    105 | export %inline
    +
    106 | emptySigset : HasIO io => io SigsetT
    +
    107 | emptySigset =
    +
    108 |   primIO $ \w => let MkIORes p w := prim__emptysigset w in MkIORes (S p) w
    + +
    110 | ||| Allocates a `sigset_t` with all signals set.
    + +
    112 | ||| This must be freed with `freeSigset`.
    +
    113 | export %inline
    +
    114 | fullSigset : HasIO io => io SigsetT
    +
    115 | fullSigset =
    +
    116 |   primIO $ \w => let MkIORes p w := prim__fullsigset w in MkIORes (S p) w
    + +
    118 | ||| Adds a signal to a `sigset_t`
    +
    119 | export %inline
    +
    120 | sigaddset : HasIO io => SigsetT -> Signal -> io ()
    +
    121 | sigaddset (S p) s = primIO $ prim__sigaddset p s.sig
    + +
    123 | ||| Removes a signal from a `sigset_t`
    +
    124 | export %inline
    +
    125 | sigdelset : HasIO io => SigsetT -> Signal -> io ()
    +
    126 | sigdelset (S p) s = primIO $ prim__sigdelset p s.sig
    + +
    128 | ||| Tests if a signal is a member of a `sigset_t`.
    +
    129 | export %inline
    +
    130 | sigismember : HasIO io => SigsetT -> Signal -> io Bool
    +
    131 | sigismember (S p) s =
    +
    132 |   primIO $ \w =>
    +
    133 |     let MkIORes r w := prim__sigismember p s.sig w
    +
    134 |      in case r of
    +
    135 |           0 => MkIORes False w
    +
    136 |           _ => MkIORes True w
    + +
    138 | --------------------------------------------------------------------------------
    +
    139 | -- API
    +
    140 | --------------------------------------------------------------------------------
    + +
    142 | ||| Sends a signal to a running process or a group of processes.
    +
    143 | export %inline
    +
    144 | kill : ErrIO io => PidT -> Signal -> io ()
    +
    145 | kill p s = toUnit $ prim__kill p s.sig
    + +
    147 | ||| Sends a signal to the calling thread.
    +
    148 | export %inline
    +
    149 | raise : HasIO io => Signal -> io ()
    +
    150 | raise s = primIO $ prim__raise s.sig
    + +
    152 | ||| Sends a realtime signal plus data word to a running process.
    + +
    154 | ||| Note that `sig` must be in the range [SIGRTMIN, SIGRTMAX].
    +
    155 | export %inline
    +
    156 | sigqueue : ErrIO io => PidT -> Signal -> (word : CInt) -> io ()
    +
    157 | sigqueue p s word = toUnit $ prim__sigqueue p s.sig word
    + +
    159 | ||| Adjust the process signal mask according to the given `How`
    +
    160 | ||| and signal set.
    + +
    162 | ||| Note: This allocates a new `sigset_t` pointer and returns the
    +
    163 | |||       previously set signal mask. Client code is responsible to
    +
    164 | |||       free the memory for this once it is no longer used.
    +
    165 | |||       See also `sigprocmask'` for a version that does not return
    +
    166 | |||       the previous signal mask.
    +
    167 | export %inline
    +
    168 | sigprocmask : HasIO io => How -> SigsetT -> io SigsetT
    +
    169 | sigprocmask h (S p) =
    +
    170 |   primIO $ \w =>
    +
    171 |     let MkIORes p2 w := prim__sigprocmask (howCode h) p w
    +
    172 |      in MkIORes (S p2) w
    + +
    174 | ||| Like `sigprocmask` but does not allocate a pointer for the
    +
    175 | ||| previous `sigset_t`.
    +
    176 | export %inline
    +
    177 | sigprocmask' : HasIO io => How -> SigsetT -> io ()
    +
    178 | sigprocmask' h (S p) = primIO $ prim__sigprocmask1 (howCode h) p
    + +
    180 | ||| Returns the current signal mask of the process.
    + +
    182 | ||| Note: This allocates a new `sigset_t` pointer and returns the
    +
    183 | |||       previously set signal mask. Client code is responsible to
    +
    184 | |||       free the memory for this once it is no longer used.
    +
    185 | export %inline
    +
    186 | siggetprocmask : HasIO io => io SigsetT
    +
    187 | siggetprocmask =
    +
    188 |   primIO $ \w =>
    +
    189 |     let MkIORes p w := prim__siggetprocmask w
    +
    190 |      in MkIORes (S p) w
    + +
    192 | ||| Returns the set of currently pending signals.
    + +
    194 | ||| Note: This allocates a new `sigset_t` pointer and returns the
    +
    195 | |||       previously set signal mask. Client code is responsible to
    +
    196 | |||       free the memory for this once it is no longer used.
    +
    197 | export %inline
    +
    198 | sigpending : HasIO io => io SigsetT
    +
    199 | sigpending =
    +
    200 |   primIO $ \w =>
    +
    201 |     let MkIORes p w := prim__sigpending w
    +
    202 |      in MkIORes (S p) w
    + +
    204 | ||| Terminates the application by raising `SIGABRT` and dumps core.
    + +
    206 | ||| While `SIGABRT` can be handled with a signal handler, `abort` is
    +
    207 | ||| still guaranteed successfully terminate the process.
    +
    208 | export %inline
    +
    209 | abort : HasIO io => io ()
    +
    210 | abort = primIO prim__abort
    + +
    212 | ||| Suspends the current thread until a non-blocked signal is encountered.
    +
    213 | export %inline
    +
    214 | pause : ErrIO io => io ()
    +
    215 | pause = do
    +
    216 |   r <- fromNeg <$> primIO prim__pause
    +
    217 |   if r == EINTR then pure () else error r
    +
    219 | --------------------------------------------------------------------------------
    - -
    221 | export
    -
    222 | record SiginfoT where
    -
    223 |   constructor ST
    -
    224 |   ptr : AnyPtr
    - -
    226 | export %inline
    -
    227 | Struct SiginfoT where
    -
    228 |   wrap   = ST
    -
    229 |   unwrap = ptr
    - -
    231 | export %inline
    -
    232 | SizeOf SiginfoT where
    -
    233 |   sizeof_ = siginfo_t_size
    - -
    235 | export %inline
    -
    236 | signal : HasIO io => SiginfoT -> io Signal
    -
    237 | signal s = primIO $ primMap S $ get_siginfo_t_si_signo s.ptr
    - -
    239 | export %inline
    -
    240 | code : HasIO io => SiginfoT -> io CInt
    -
    241 | code s = primIO $ get_siginfo_t_si_code s.ptr
    - -
    243 | export %inline
    -
    244 | pid : HasIO io => SiginfoT -> io PidT
    -
    245 | pid s = primIO $ get_siginfo_t_si_pid s.ptr
    - -
    247 | export %inline
    -
    248 | uid : HasIO io => SiginfoT -> io UidT
    -
    249 | uid s = primIO $ get_siginfo_t_si_uid s.ptr
    - -
    251 | export %inline
    -
    252 | status : HasIO io => SiginfoT -> io CInt
    -
    253 | status s = primIO $ get_siginfo_t_si_status s.ptr
    - -
    255 | export %inline
    -
    256 | value : HasIO io => SiginfoT -> io CInt
    -
    257 | value s = primIO $ get_siginfo_t_si_value s.ptr
    - -
    259 | ||| Atomically blocks the signals in `set`, then
    -
    260 | ||| pauses the thread (see `pause`) and restores the signal set
    -
    261 | ||| afterwards.
    -
    262 | export %inline
    -
    263 | sigsuspend : (set : SigsetT) -> IO (Either Errno ())
    -
    264 | sigsuspend (S s) =
    -
    265 |   toUnit (prim__sigsuspend s) >>= \case
    -
    266 |     Left EINTR => pure $ Right () -- this is the normal case
    -
    267 |     x          => pure x
    - -
    269 | ||| Synchronously awaits one of the signals in `set`.
    - -
    271 | ||| Note: Usually, the signals in `set` should first be blocked via
    -
    272 | |||       `sigprocmask`.
    -
    273 | export %inline
    -
    274 | sigwaitinfo : (set : SigsetT) -> (info : SiginfoT) -> IO (Either Errno ())
    -
    275 | sigwaitinfo (S s) (ST i) = toUnit $ prim__sigwaitinfo s i
    - -
    277 | ||| Like `sigwaitinfo` but times out with `EAGAIN` after `sec` seconds and
    -
    278 | ||| `nsec` nanoseconds.
    -
    279 | export %inline
    -
    280 | sigtimedwait :
    -
    281 |      (set  : SigsetT)
    -
    282 |   -> (info : SiginfoT)
    -
    283 |   -> (sec  : TimeT)
    -
    284 |   -> (nsec : NsecT)
    -
    285 |   -> IO (Either Errno ())
    -
    286 | sigtimedwait (S s) (ST i) sec nsec = toUnit $ prim__sigtimedwait s i sec nsec
    - +
    220 | -- Synchronous Signal Handling
    +
    221 | --------------------------------------------------------------------------------
    + +
    223 | export
    +
    224 | record SiginfoT where
    +
    225 |   constructor ST
    +
    226 |   ptr : AnyPtr
    + +
    228 | export %inline
    +
    229 | Struct SiginfoT where
    +
    230 |   wrap   = ST
    +
    231 |   unwrap = ptr
    + +
    233 | export %inline
    +
    234 | SizeOf SiginfoT where
    +
    235 |   sizeof_ = siginfo_t_size
    + +
    237 | export %inline
    +
    238 | signal : HasIO io => SiginfoT -> io Signal
    +
    239 | signal s = primMap S $ get_siginfo_t_si_signo s.ptr
    + +
    241 | export %inline
    +
    242 | code : HasIO io => SiginfoT -> io CInt
    +
    243 | code s = primIO $ get_siginfo_t_si_code s.ptr
    + +
    245 | export %inline
    +
    246 | pid : HasIO io => SiginfoT -> io PidT
    +
    247 | pid s = primIO $ get_siginfo_t_si_pid s.ptr
    + +
    249 | export %inline
    +
    250 | uid : HasIO io => SiginfoT -> io UidT
    +
    251 | uid s = primIO $ get_siginfo_t_si_uid s.ptr
    + +
    253 | export %inline
    +
    254 | status : HasIO io => SiginfoT -> io CInt
    +
    255 | status s = primIO $ get_siginfo_t_si_status s.ptr
    + +
    257 | export %inline
    +
    258 | value : HasIO io => SiginfoT -> io CInt
    +
    259 | value s = primIO $ get_siginfo_t_si_value s.ptr
    + +
    261 | ||| Atomically blocks the signals in `set`, then
    +
    262 | ||| pauses the thread (see `pause`) and restores the signal set
    +
    263 | ||| afterwards.
    +
    264 | export %inline
    +
    265 | sigsuspend : ErrIO io => (set : SigsetT) -> io ()
    +
    266 | sigsuspend (S s) = do
    +
    267 |   r <- fromNeg <$> primIO (prim__sigsuspend s)
    +
    268 |   if r == EINTR then pure () else error r
    + +
    270 | ||| Synchronously awaits one of the signals in `set`.
    + +
    272 | ||| Note: Usually, the signals in `set` should first be blocked via
    +
    273 | |||       `sigprocmask`.
    +
    274 | export %inline
    +
    275 | sigwaitinfo : ErrIO io => (set : SigsetT) -> (info : SiginfoT) -> io ()
    +
    276 | sigwaitinfo (S s) (ST i) = toUnit $ prim__sigwaitinfo s i
    + +
    278 | ||| Synchronously awaits one of the signals in `set`.
    + +
    280 | ||| This is like `sigwaitinfo` but with a simpler API.
    +
    281 | export %inline
    +
    282 | sigwait : ErrIO io => (set : SigsetT) -> io Signal
    +
    283 | sigwait (S s) = toVal (S . cast) $ prim__sigwait s
    + +
    285 | ||| Like `sigwaitinfo` but times out with `EAGAIN` after `sec` seconds and
    +
    286 | ||| `nsec` nanoseconds.
    +
    287 | export %inline
    +
    288 | sigtimedwait :
    +
    289 |      {auto has : ErrIO io}
    +
    290 |   -> (set  : SigsetT)
    +
    291 |   -> (info : SiginfoT)
    +
    292 |   -> (sec  : TimeT)
    +
    293 |   -> (nsec : NsecT)
    +
    294 |   -> io ()
    +
    295 | sigtimedwait (S s) (ST i) sec nsec = toUnit $ prim__sigtimedwait s i sec nsec
    + diff --git a/docs/posix/docs/docs/System.Posix.Time.html b/docs/posix/docs/docs/System.Posix.Time.html index 1b5eb6ca4..8beab4de3 100644 --- a/docs/posix/docs/docs/System.Posix.Time.html +++ b/docs/posix/docs/docs/System.Posix.Time.html @@ -61,4 +61,4 @@ -

    System.Posix.Time

    (source)

    Reexports

    importpublic Data.C.Integer
    importpublic System.Posix.Time.Types
    importpublic System.Clock

    Definitions

    recordTimespec : Type
      A wrapper around a `struct timespec` pointer.

    Totality: total
    Visibility: export
    Constructor: 
    TS : AnyPtr->Timespec

    Projection: 
    .ptr : Timespec->AnyPtr

    Hints:
    SizeOfTimespec
    StructTimespec
    sec : HasIOio=>Timespec->ioTimeT
      Reads the `tv_sec` field of a `timespec` pointer.

    Totality: total
    Visibility: export
    nsec : HasIOio=>Timespec->ioNsecT
      Reads the `tv_nsec` field of a `timespec` pointer.

    Totality: total
    Visibility: export
    setSec : HasIOio=>Timespec->TimeT->io ()
      Sets the `tv_sec` field of a `timespec` pointer.

    Totality: total
    Visibility: export
    setNsec : HasIOio=>Timespec->NsecT->io ()
      Sets the `tv_nsec` field of a `timespec` pointer.

    Totality: total
    Visibility: export
    toClock : HasIOio=>Timespec->io (Clockt)
      Convert a `Timespec` to a `Clock t`

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Time

    (source)

    Reexports

    importpublic Data.C.Integer
    importpublic System.Posix.Time.Types
    importpublic System.Clock

    Definitions

    recordTimespec : Type
      A wrapper around a `struct timespec` pointer.

    Totality: total
    Visibility: export
    Constructor: 
    TS : AnyPtr->Timespec

    Projection: 
    .ptr : Timespec->AnyPtr

    Hints:
    SizeOfTimespec
    StructTimespec
    sec : HasIOio=>Timespec->ioTimeT
      Reads the `tv_sec` field of a `timespec` pointer.

    Totality: total
    Visibility: export
    nsec : HasIOio=>Timespec->ioNsecT
      Reads the `tv_nsec` field of a `timespec` pointer.

    Totality: total
    Visibility: export
    setSec : HasIOio=>Timespec->TimeT->io ()
      Sets the `tv_sec` field of a `timespec` pointer.

    Totality: total
    Visibility: export
    setNsec : HasIOio=>Timespec->NsecT->io ()
      Sets the `tv_nsec` field of a `timespec` pointer.

    Totality: total
    Visibility: export
    toClock : HasIOio=>Timespec->io (Clockt)
      Convert a `Timespec` to a `Clock t`

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Timer.Types.html b/docs/posix/docs/docs/System.Posix.Timer.Types.html index cae086762..7eebf81b3 100644 --- a/docs/posix/docs/docs/System.Posix.Timer.Types.html +++ b/docs/posix/docs/docs/System.Posix.Timer.Types.html @@ -61,4 +61,4 @@ -

    System.Posix.Timer.Types

    (source)

    Definitions

    dataWhich : Type
    Totality: total
    Visibility: public export
    Constructors:
    ITIMER_REAL : Which
    ITIMER_VIRTUAL : Which
    ITIMER_PROF : Which

    Hints:
    EqWhich
    FiniteWhich
    OrdWhich
    ShowWhich
    dataClockId : Type
    Totality: total
    Visibility: public export
    Constructors:
    CLOCK_REALTIME : ClockId
    CLOCK_MONOTONIC : ClockId
    CLOCK_PROCESS_CPUTIME_ID : ClockId
    CLOCK_THREAD_CPUTIME_ID : ClockId

    Hints:
    EqClockId
    FiniteClockId
    OrdClockId
    ShowClockId
    whichCode : Which->Bits8
    Totality: total
    Visibility: public export
    clockCode : ClockId->Bits8
    Totality: total
    Visibility: public export
    timeval_size : Nat
    Totality: total
    Visibility: public export
    itimerval_size : Nat
    Totality: total
    Visibility: public export
    itimerspec_size : Nat
    Totality: total
    Visibility: public export
    CLOCKS_PER_SEC : ClockT
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Timer.Types

    (source)

    Definitions

    dataWhich : Type
    Totality: total
    Visibility: public export
    Constructors:
    ITIMER_REAL : Which
    ITIMER_VIRTUAL : Which
    ITIMER_PROF : Which

    Hints:
    EqWhich
    FiniteWhich
    OrdWhich
    ShowWhich
    dataClockId : Type
    Totality: total
    Visibility: public export
    Constructors:
    CLOCK_REALTIME : ClockId
    CLOCK_MONOTONIC : ClockId
    CLOCK_PROCESS_CPUTIME_ID : ClockId
    CLOCK_THREAD_CPUTIME_ID : ClockId

    Hints:
    EqClockId
    FiniteClockId
    OrdClockId
    ShowClockId
    whichCode : Which->Bits8
    Totality: total
    Visibility: public export
    clockCode : ClockId->Bits8
    Totality: total
    Visibility: public export
    timeval_size : Nat
    Totality: total
    Visibility: public export
    itimerval_size : Nat
    Totality: total
    Visibility: public export
    itimerspec_size : Nat
    Totality: total
    Visibility: public export
    CLOCKS_PER_SEC : ClockT
    Totality: total
    Visibility: public export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Timer.html b/docs/posix/docs/docs/System.Posix.Timer.html index e1b291569..a241b87a8 100644 --- a/docs/posix/docs/docs/System.Posix.Timer.html +++ b/docs/posix/docs/docs/System.Posix.Timer.html @@ -61,4 +61,4 @@ -

    System.Posix.Timer

    (source)

    Reexports

    importpublic Data.C.Integer
    importpublic System.Posix.Errno
    importpublic System.Posix.Timer.Types
    importpublic System.Posix.Time

    Definitions

    recordTimeval : Type
    Totality: total
    Visibility: export
    Constructor: 
    TV : AnyPtr->Timeval

    Projection: 
    .ptr : Timeval->AnyPtr

    Hints:
    SizeOfTimeval
    StructTimeval
    sec : HasIOio=>Timeval->ioTimeT
    Totality: total
    Visibility: export
    usec : HasIOio=>Timeval->ioSusecondsT
    Totality: total
    Visibility: export
    setsec : HasIOio=>Timeval->TimeT->io ()
    Totality: total
    Visibility: export
    setusec : HasIOio=>Timeval->SusecondsT->io ()
    Totality: total
    Visibility: export
    timeval : HasIOio=>TimeT->SusecondsT->ioTimeval
    Totality: total
    Visibility: export
    recordItimerval : Type
    Totality: total
    Visibility: export
    Constructor: 
    ITV : AnyPtr->Itimerval

    Projection: 
    .ptr : Itimerval->AnyPtr

    Hints:
    SizeOfItimerval
    StructItimerval
    interval : HasIOio=>Itimerval->ioTimeval
    Totality: total
    Visibility: export
    value : HasIOio=>Itimerval->ioTimeval
    Totality: total
    Visibility: export
    setinterval : HasIOio=>Itimerval->Timeval->io ()
    Totality: total
    Visibility: export
    setvalue : HasIOio=>Itimerval->Timeval->io ()
    Totality: total
    Visibility: export
    itimerval : HasIOio=>TimeT->SusecondsT->TimeT->SusecondsT->ioItimerval
      Creates and sets the fields of a `Itimerval` pointer.

    The allocated memory must be freed via `freeStruct`.

    Totality: total
    Visibility: export
    get_itimerspec_it_interval : AnyPtr->PrimIOAnyPtr
    get_itimerspec_it_value : AnyPtr->PrimIOAnyPtr
    set_itimerspec_it_interval : AnyPtr->AnyPtr->PrimIO ()
    set_itimerspec_it_value : AnyPtr->AnyPtr->PrimIO ()
    recordItimerspec : Type
    Totality: total
    Visibility: export
    Constructor: 
    ITS : AnyPtr->Itimerspec

    Projection: 
    .ptr : Itimerspec->AnyPtr

    Hints:
    SizeOfItimerspec
    StructItimerspec
    interval : HasIOio=>Itimerspec->ioTimespec
    Totality: total
    Visibility: export
    value : HasIOio=>Itimerspec->ioTimespec
    Totality: total
    Visibility: export
    setinterval : HasIOio=>Itimerspec->Timespec->io ()
    Totality: total
    Visibility: export
    setvalue : HasIOio=>Itimerspec->Timespec->io ()
    Totality: total
    Visibility: export
    itimerspec : HasIOio=>TimeT->NsecT->TimeT->NsecT->ioItimerspec
      Creates and sets the fields of a `Itimerspec` pointer.

    The allocated memory must be freed via `freeStruct`.

    Totality: total
    Visibility: export
    clock : HasIOio=>ioClockT
      Returns an approximation of processor time used by the program.

    Type `ClockT` measures time with a granularity of
    `CLOCKS_PER_SEC`.

    Totality: total
    Visibility: export
    setitimer : Which->Itimerval->Itimerval->IO (EitherErrno ())
      This sets `new` as the new timer and places the current timer for
    `Which` in `old`.

    Depending on `Which`, the timer will use a different clock and
    will (possibly repeatedly) raise a different kind signal:

    * ITIMER_REAL: Counts down in real (i.e. wall clock) time
    and raises SIGALRM
    * ITIMER_VIRTUAL: Counts down in process virtual time
    (i.e. user-mode CPU time) and raises SIGVTALRM
    * ITIMER_PROF: Counts down in process time
    (i.e. the sum of kernel-mode and user-mode CPU time) and raises SIGPROF

    Totality: total
    Visibility: export
    setitimer' : Which->Itimerval->IO (EitherErrno ())
      Like `setitimer` but does not store the old timer in a pointer.

    Totality: total
    Visibility: export
    getitimer : Which->Itimerval->IO (EitherErrno ())
      Writes the currently set timer for `Which` into `old.

    Totality: total
    Visibility: export
    alarm : HasIOio=>UInt->ioUInt
      A very basic version of `setitimer` that raises `SIGALRM`
    after the given number of seconds.

    The returned value is the remaining number of seconds on any
    previously set timer. The timer can be disabled by setting
    this to zero.

    Totality: total
    Visibility: export
    clockGetTime : ClockId->Timespec->IO (EitherErrno ())
      Writes the current time for the given clock into the
    `Timespec` pointer.

    Totality: total
    Visibility: export
    clockGetRes : ClockId->Timespec->IO (EitherErrno ())
      Writes the resolution for the given clock into the
    `Timespec` pointer.

    Totality: total
    Visibility: export
    nanosleep : Timespec->Timespec->IO (EitherErrno ())
      High resolution sleeping for the duration given in `dur`.

    In case this is interrupted by a signal, it returns `Left EINTR`
    and writes the remaining duration into `rem`.

    Totality: total
    Visibility: export
    nanosleep' : Timespec->IO (EitherErrno ())
      Like `nanosleep` but without the capability of keeping track of the
    remaining duration in case of a signal interrupt.

    Totality: total
    Visibility: export
    clockNanosleep : ClockId->Timespec->Timespec->IO (EitherErrno ())
      Like `nanosleep` but allows us to specify the system clock to use.

    Totality: total
    Visibility: export
    clockNanosleepAbs : ClockId->Timespec->IO (EitherErrno ())
      Like `clockNanosleep` but uses an absolute time value instead of a duration.

    This is useful to get exact wakeup times even in case of lots of signal
    interrupts.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    +

    System.Posix.Timer

    (source)

    Reexports

    importpublic Data.C.Integer
    importpublic System.Posix.Errno
    importpublic System.Posix.Timer.Types
    importpublic System.Posix.Time

    Definitions

    recordTimeval : Type
    Totality: total
    Visibility: export
    Constructor: 
    TV : AnyPtr->Timeval

    Projection: 
    .ptr : Timeval->AnyPtr

    Hints:
    SizeOfTimeval
    StructTimeval
    sec : HasIOio=>Timeval->ioTimeT
    Totality: total
    Visibility: export
    usec : HasIOio=>Timeval->ioSusecondsT
    Totality: total
    Visibility: export
    setsec : HasIOio=>Timeval->TimeT->io ()
    Totality: total
    Visibility: export
    setusec : HasIOio=>Timeval->SusecondsT->io ()
    Totality: total
    Visibility: export
    timeval : HasIOio=>TimeT->SusecondsT->ioTimeval
    Totality: total
    Visibility: export
    recordItimerval : Type
    Totality: total
    Visibility: export
    Constructor: 
    ITV : AnyPtr->Itimerval

    Projection: 
    .ptr : Itimerval->AnyPtr

    Hints:
    SizeOfItimerval
    StructItimerval
    interval : HasIOio=>Itimerval->ioTimeval
    Totality: total
    Visibility: export
    value : HasIOio=>Itimerval->ioTimeval
    Totality: total
    Visibility: export
    setinterval : HasIOio=>Itimerval->Timeval->io ()
    Totality: total
    Visibility: export
    setvalue : HasIOio=>Itimerval->Timeval->io ()
    Totality: total
    Visibility: export
    itimerval : HasIOio=>TimeT->SusecondsT->TimeT->SusecondsT->ioItimerval
      Creates and sets the fields of a `Itimerval` pointer.

    The allocated memory must be freed via `freeStruct`.

    Totality: total
    Visibility: export
    get_itimerspec_it_interval : AnyPtr->PrimIOAnyPtr
    get_itimerspec_it_value : AnyPtr->PrimIOAnyPtr
    set_itimerspec_it_interval : AnyPtr->AnyPtr->PrimIO ()
    set_itimerspec_it_value : AnyPtr->AnyPtr->PrimIO ()
    recordItimerspec : Type
    Totality: total
    Visibility: export
    Constructor: 
    ITS : AnyPtr->Itimerspec

    Projection: 
    .ptr : Itimerspec->AnyPtr

    Hints:
    SizeOfItimerspec
    StructItimerspec
    interval : HasIOio=>Itimerspec->ioTimespec
    Totality: total
    Visibility: export
    value : HasIOio=>Itimerspec->ioTimespec
    Totality: total
    Visibility: export
    setinterval : HasIOio=>Itimerspec->Timespec->io ()
    Totality: total
    Visibility: export
    setvalue : HasIOio=>Itimerspec->Timespec->io ()
    Totality: total
    Visibility: export
    itimerspec : HasIOio=>TimeT->NsecT->TimeT->NsecT->ioItimerspec
      Creates and sets the fields of a `Itimerspec` pointer.

    The allocated memory must be freed via `freeStruct`.

    Totality: total
    Visibility: export
    clock : HasIOio=>ioClockT
      Returns an approximation of processor time used by the program.

    Type `ClockT` measures time with a granularity of
    `CLOCKS_PER_SEC`.

    Totality: total
    Visibility: export
    setitimer : ErrIOio=>Which->Itimerval->Itimerval->io ()
      This sets `new` as the new timer and places the current timer for
    `Which` in `old`.

    Depending on `Which`, the timer will use a different clock and
    will (possibly repeatedly) raise a different kind signal:

    * ITIMER_REAL: Counts down in real (i.e. wall clock) time
    and raises SIGALRM
    * ITIMER_VIRTUAL: Counts down in process virtual time
    (i.e. user-mode CPU time) and raises SIGVTALRM
    * ITIMER_PROF: Counts down in process time
    (i.e. the sum of kernel-mode and user-mode CPU time) and raises SIGPROF

    Totality: total
    Visibility: export
    setitimer' : ErrIOio=>Which->Itimerval->io ()
      Like `setitimer` but does not store the old timer in a pointer.

    Totality: total
    Visibility: export
    getitimer : ErrIOio=>Which->Itimerval->io ()
      Writes the currently set timer for `Which` into `old.

    Totality: total
    Visibility: export
    alarm : HasIOio=>UInt->ioUInt
      A very basic version of `setitimer` that raises `SIGALRM`
    after the given number of seconds.

    The returned value is the remaining number of seconds on any
    previously set timer. The timer can be disabled by setting
    this to zero.

    Totality: total
    Visibility: export
    clockGetTime : ErrIOio=>ClockId->Timespec->io ()
      Writes the current time for the given clock into the
    `Timespec` pointer.

    Totality: total
    Visibility: export
    clockGetRes : ErrIOio=>ClockId->Timespec->io ()
      Writes the resolution for the given clock into the
    `Timespec` pointer.

    Totality: total
    Visibility: export
    nanosleep : ErrIOio=>Timespec->Timespec->io ()
      High resolution sleeping for the duration given in `dur`.

    In case this is interrupted by a signal, it returns `Left EINTR`
    and writes the remaining duration into `rem`.

    Totality: total
    Visibility: export
    nanosleep' : ErrIOio=>Timespec->io ()
      Like `nanosleep` but without the capability of keeping track of the
    remaining duration in case of a signal interrupt.

    Totality: total
    Visibility: export
    clockNanosleep : ErrIOio=>ClockId->Timespec->Timespec->io ()
      Like `nanosleep` but allows us to specify the system clock to use.

    Totality: total
    Visibility: export
    clockNanosleepAbs : ErrIOio=>ClockId->Timespec->io ()
      Like `clockNanosleep` but uses an absolute time value instead of a duration.

    This is useful to get exact wakeup times even in case of lots of signal
    interrupts.

    Totality: total
    Visibility: export
    Produced by Idris 2 version 0.7.0-6d02c5210
    diff --git a/docs/posix/docs/docs/System.Posix.Timer.src.html b/docs/posix/docs/docs/System.Posix.Timer.src.html index ac4872188..096702387 100644 --- a/docs/posix/docs/docs/System.Posix.Timer.src.html +++ b/docs/posix/docs/docs/System.Posix.Timer.src.html @@ -180,7 +180,7 @@
     60 | export %inline
     61 | timeval : HasIO io => TimeT -> SusecondsT -> io Timeval
    -
     62 | timeval s u = primIO $ primMap TV $ prim__timeval s u
    +
     62 | timeval s u = primMap TV $ prim__timeval s u
     64 | --------------------------------------------------------------------------------
     65 | -- Itimerval
    @@ -217,11 +217,11 @@
     97 | export %inline
     98 | interval : HasIO io => Itimerval -> io Timeval
    -
     99 | interval s = primIO $ primMap TV $ get_itimerval_it_interval s.ptr
    +
     99 | interval s = primMap TV $ get_itimerval_it_interval s.ptr
    101 | export %inline
    102 | value : HasIO io => Itimerval -> io Timeval
    -
    103 | value s = primIO $ primMap TV $ get_itimerval_it_value s.ptr
    +
    103 | value s = primMap TV $ get_itimerval_it_value s.ptr
    105 | export %inline
    106 | setinterval : HasIO io => Itimerval -> Timeval -> io ()
    @@ -243,7 +243,7 @@
    122 |   -> (usecValue    : SusecondsT)
    123 |   -> io Itimerval
    124 | itimerval si ui sv uv = do
    -
    125 |   primIO $ primMap ITV $ prim__itimerval si ui sv uv
    +
    125 |   primMap ITV $ prim__itimerval si ui sv uv
    127 | --------------------------------------------------------------------------------
    128 | -- Itimerspec
    @@ -281,11 +281,11 @@
    160 | namespace Itimerspec
    161 |   export %inline
    162 |   interval : HasIO io => Itimerspec -> io Timespec
    -
    163 |   interval s = primIO $ primMap wrap $ get_itimerspec_it_interval s.ptr
    +
    163 |   interval s = primMap wrap $ get_itimerspec_it_interval s.ptr
    165 |   export %inline
    166 |   value : HasIO io => Itimerspec -> io Timespec
    -
    167 |   value s = primIO $ primMap wrap $ get_itimerspec_it_value s.ptr
    +
    167 |   value s = primMap wrap $ get_itimerspec_it_value s.ptr
    170 |   export %inline
    @@ -308,7 +308,7 @@
    187 |   -> (usecValue    : NsecT)
    188 |   -> io Itimerspec
    189 | itimerspec si ni sv nv = do
    -
    190 |   primIO $ primMap ITS $ prim__itimerspec si ni sv nv
    +
    190 |   primMap ITS $ prim__itimerspec si ni sv nv
    192 | --------------------------------------------------------------------------------
    193 | -- FFI
    @@ -372,17 +372,17 @@
    251 | ||| * ITIMER_PROF: Counts down in process time
    252 | |||   (i.e. the sum of kernel-mode and user-mode CPU time) and raises SIGPROF
    253 | export %inline
    -
    254 | setitimer : Which -> (new,old : Itimerval) -> IO (Either Errno ())
    +
    254 | setitimer : ErrIO io => Which -> (new,old : Itimerval) -> io ()
    255 | setitimer w (ITV n) (ITV o) = toUnit $ prim__setitimer (whichCode w) n o
    257 | ||| Like `setitimer` but does not store the old timer in a pointer.
    258 | export %inline
    -
    259 | setitimer' : Which -> (new : Itimerval) -> IO (Either Errno ())
    +
    259 | setitimer' : ErrIO io => Which -> (new : Itimerval) -> io ()
    260 | setitimer' w (ITV n) = toUnit $ prim__setitimer1 (whichCode w) n
    262 | ||| Writes the currently set timer for `Which` into `old.
    263 | export %inline
    -
    264 | getitimer : Which -> (old : Itimerval) -> IO (Either Errno ())
    +
    264 | getitimer : ErrIO io => Which -> (old : Itimerval) -> io ()
    265 | getitimer w (ITV o) = toUnit $ prim__getitimer (whichCode w) o
    267 | ||| A very basic version of `setitimer` that raises `SIGALRM`
    @@ -398,13 +398,13 @@
    277 | ||| Writes the current time for the given clock into the
    278 | ||| `Timespec` pointer.
    279 | export %inline
    -
    280 | clockGetTime : ClockId -> Timespec -> IO (Either Errno ())
    +
    280 | clockGetTime : ErrIO io => ClockId -> Timespec -> io ()
    281 | clockGetTime c t = toUnit $ prim__clock_gettime (clockCode c) (unwrap t)
    283 | ||| Writes the resolution for the given clock into the
    284 | ||| `Timespec` pointer.
    285 | export %inline
    -
    286 | clockGetRes : ClockId -> Timespec -> IO (Either Errno ())
    +
    286 | clockGetRes : ErrIO io => ClockId -> Timespec -> io ()
    287 | clockGetRes c t = toUnit $ prim__clock_getres (clockCode c) (unwrap t)
    289 | ||| High resolution sleeping for the duration given in `dur`.
    @@ -412,18 +412,18 @@
    291 | ||| In case this is interrupted by a signal, it returns `Left EINTR`
    292 | ||| and writes the remaining duration into `rem`.
    293 | export %inline
    -
    294 | nanosleep : (dur,rem : Timespec) -> IO (Either Errno ())
    +
    294 | nanosleep : ErrIO io => (dur,rem : Timespec) -> io ()
    295 | nanosleep d r = toUnit $ prim__nanosleep (unwrap d) (unwrap r)
    297 | ||| Like `nanosleep` but without the capability of keeping track of the
    298 | ||| remaining duration in case of a signal interrupt.
    299 | export %inline
    -
    300 | nanosleep' : (dur : Timespec) -> IO (Either Errno ())
    +
    300 | nanosleep' : ErrIO io => (dur : Timespec) -> io ()
    301 | nanosleep' d = toUnit $ prim__nanosleep1 (unwrap d)
    303 | ||| Like `nanosleep` but allows us to specify the system clock to use.
    304 | export %inline
    -
    305 | clockNanosleep : ClockId -> (dur,rem : Timespec) -> IO (Either Errno ())
    +
    305 | clockNanosleep : ErrIO io => ClockId -> (dur,rem : Timespec) -> io ()
    306 | clockNanosleep c d r =
    307 |   posToUnit $ prim__clock_nanosleep (clockCode c) (unwrap d) (unwrap r)
    @@ -432,11 +432,10 @@
    311 | ||| This is useful to get exact wakeup times even in case of lots of signal
    312 | ||| interrupts.
    313 | export %inline
    -
    314 | clockNanosleepAbs : ClockId -> (time : Timespec) -> IO (Either Errno ())
    +
    314 | clockNanosleepAbs : ErrIO io => ClockId -> (time : Timespec) -> io ()
    315 | clockNanosleepAbs c d =
    316 |   posToUnit $ prim__clock_nanosleep_abs (clockCode c) (unwrap d)
    - diff --git a/docs/posix/docs/index.html b/docs/posix/docs/index.html index d5c94aab5..a300b6608 100644 --- a/docs/posix/docs/index.html +++ b/docs/posix/docs/index.html @@ -143,6 +143,15 @@
  • +
    + +
    + +
    +
    +