scouter
library
Classes
AppModule
Your application root module, here you will add your modules, controllers, etc.
It must be your application entry point, which should be provided to the runServer() function
Body
Compose <Input , Output >
Compose a series of functions, the output of the previous function in the chain
is automatically passed as input to the next function in the chain.
Compose2 <Input1 , Input2 , Output >
Compose a series of functions, the output of the previous function in the chain
is automatically passed as input to the next function in the chain.
Delete
Add this annotation to a RestController public method to declare a DELETE route
Either <L , R >
Represents a value of one of two possible types, Left or Right .
Eq <T >
A type class used to determine equality between 2 instances of the same type T
.
Any 2 instances x
and y
are equal if eqv(x, y)
is true
.
FactoryInjection <T extends Object >
Represents a Factory instance to be injected
Get
Add this annotation to a RestController public method to declare a GET route
Hash <T >
A type class used to represent a hashing scheme for objects of a given type.
Head
Add this annotation to a RestController public method to declare a HEAD route
HKT <G , A >
https://marcosh.github.io/post/2020/04/15/higher-kinded-types-php-solution.html
https://medium.com/@gcanti/higher-kinded-types-in-flow-275b657992b7
HKT2 <G1 , G2 , A >
HttpController
HttpController is an Annotation that declares a Controller, that must also extends a RestController
HttpMiddleware
A Middleware runs before a http route handler. You must implement it, and make the constructor const, before adding to a controller or module.
To return something from a middleware, you should use a Left() return:
HttpRequest
A Request object, which should always be placed as an argument for a route handler
HttpResponse
Your route response
HttpRoute
Routes declared in a @HttpController are nothing but a http route like this
HttpVerb
HttpVerb is a base for Methods Annotation, to handle Scouter Routing
Injection <T extends Object >
Injection is a wrapper of an instance to be injected
InjectionManager <Injector >
Injection Manager is an interface to handle container registration
IO <A >
IO<A>
represents a non-deterministic synchronous computation that
can cause side effects , yields a value of type A
and never fails .
IOEither <L , R >
IOEither<L, R>
represents a non-deterministic synchronous computation that
can cause side effects , yields a value of type R
or can fail by returning
a value of type L
.
IORef <T >
Mutable reference in the IO monad.
KiwiInjector
A Kiwi implementation of our abstraction InjectionManager .
You can also do your own implementation if you wish.
Left <L , R >
Module
A Module represents a context of your software. Each Module have its own controllers and middlewares.
A Module needs to be extended and its preffix property will declare a part of your routes.
None <T >
Option <T >
A type that can contain a value of type T
in a Some or no value with None .
Options
Add this annotation to a RestController public method to declare a OPTIONS route
Order <T >
The Order
type class is used to define a total ordering
on some type A
.
PartialOrder <T >
The PartialOrder
type class is used to define a
partial ordering on some type A
.
Patch
Add this annotation to a RestController public method to declare a PATCH route
Post
Add this annotation to a RestController public method to declare a POST route
Predicate <T >
Compose functions that given a generic value T
return a bool
.
Put
Add this annotation to a RestController public method to declare a PUT route
QueryParam
Reader <R , A >
Reader<R, A>
allows to read values A
from a dependency/context R
without explicitly passing the dependency between multiple nested
function calls.
ReaderHKT
Tag the HKT2 interface for the actual Reader .
RestController
RestController is a class that Controllers must extend to be implemented to Modules
.
It is decorated with Injectable Mixin, it means that every RestController has access to DI functions inject
Right <L , R >
SingletonInjection <T extends Object >
Represents a Singleton instance to be injected
Some <T >
State <S , A >
State<S, A>
is used to store, update, and extract state in a functional way.
StateAsync <S , A >
StateAsync<S, A>
is used to store, update, and extract async state in a functional way.
Task <A >
Task represents an asynchronous computation that yields a value of type A
and never fails .
TaskEither <L , R >
TaskEither<L, R>
represents an asynchronous computation that
either yields a value of type R
or fails yielding an error of type L
.
TaskOption <R >
TaskOption<R>
represents an asynchronous computation that
may fails yielding a None or returns a Some(R)
when successful.
Tuple2 <T1 , T2 >
Tuple2<T1, T2>
is a type that contains a value of type T1
and a value of type T2
.
Unit
Used instead of void
as a return statement for a function when no value is to be returned.
Mixins
Alt <KT , A >
Alt
type class identifies an associative operation on a type constructor.
Alt2 <KT , A , B >
Applicative <G , A >
Applicative2 <G , A , B >
Band <T >
Bands are semigroups whose operation
(i.e. combine
) is also idempotent
(an operation that can be applied multiple times without changing the result beyond the initial application).
BoundedSemilattice <T >
A semilattice in which:
CommutativeGroup <T >
An commutative group (also known as an abelian group )
is a group whose combine operation is commutative .
CommutativeMonoid <T >
CommutativeMonoid
represents a commutative monoid.
CommutativeSemigroup <T >
CommutativeSemigroup
represents a commutative semigroup.
Extend <KT , A >
Extend2 <KT , A , B >
Filterable <KT , A >
Foldable <G , A >
Foldable2 <G , A , B >
Functor <G , A >
Functor<G, A> extends HKT<G, A>
to express the fact that the classes implementing
the Functor interface will need to be higher kinded types.
Functor2 <G , A , B >
Group <T >
A group is a monoid where each element has an inverse .
Injectable
A Mixin that provides Dependency Injection functions.
Monad <KT , A >
Monad2 <KT , A , B >
Monoid <T >
A monoid is a semigroup with an identity (empty
).
Semigroup <T >
A semigroup is any set A
with an associative operation (combine
).
Semilattice <T >
Semilattices
are commutative semigroups whose operation
(i.e. combine
) is also idempotent .
Extensions
ComposeOnFunction1
on Output Function(Input )
ComposeOnFunction2
on Output Function(Input1 , Input2 )
CurryExtension2
on Output Function(Input1 , Input2 )
CurryExtension3
on Output Function(Input1 , Input2 , Input3 )
CurryExtension4
on Output Function(Input1 , Input2 , Input3 , Input4 )
CurryExtension5
on Output Function(Input1 , Input2 , Input3 , Input4 , Input5 )
FpdartBoolean
on bool
fpdart
extension methods on bool
FpdartDateTime
on DateTime
fpdart
extension methods on DateTime
FpdartOnMutableIterable
on Iterable <T >
Functional programming functions on a mutable dart Iterable using fpdart
.
FpdartOnMutableIterableOfIterable
on Iterable <Iterable <T > >
Functional programming functions on a mutable dart Iterable<Iterable<T>>
using fpdart
.
FpdartOnMutableMap
on Map <K , V >
Functional programming functions on a mutable dart Map using fpdart
.
FpdartOnNullable
on T?
fpdart
extension to work on nullable values T?
FpdartOnOptionMutableMap
on Option <Map <K , dynamic > >
FpdartSequenceIterableEither
on Iterable <Either <E , A > >
FpdartSequenceIterableIO
on Iterable <IO <T > >
FpdartSequenceIterableIOEither
on Iterable <IOEither <E , T > >
FpdartSequenceIterableOption
on Iterable <Option <T > >
FpdartSequenceIterableTask
on Iterable <Task <T > >
FpdartSequenceIterableTaskEither
on Iterable <TaskEither <E , T > >
FpdartSequenceIterableTaskOption
on Iterable <TaskOption <T > >
FpdartTraversableIterable
on Iterable <T >
UncurryExtension2
on Output Function(Input2 ) Function(Input1 )
UncurryExtension3
on Output Function(Input3 ) Function(Input2 ) Function(Input1 )
UncurryExtension4
on Output Function(Input4 ) Function(Input3 ) Function(Input2 ) Function(Input1 )
UncurryExtension5
on Output Function(Input5 ) Function(Input4 ) Function(Input3 ) Function(Input2 ) Function(Input1 )
Constants
unit
→ const Unit
Used instead of void
as a return statement for a function when no value is to be returned.
Functions
boolAndMonoid ()
→ Monoid <bool >
boolOrMonoid ()
→ Monoid <bool >
constF <A > (A a )
→ A Function(dynamic b )
constf a
is a unary function which evaluates to a
for all inputs.
curry2 <FirstParameter , SecondParameter , ReturnType > (ReturnType function (FirstParameter first , SecondParameter second ) )
→ ReturnType Function(SecondParameter second ) Function(FirstParameter first )
Converts a binary function into a unary function that returns a unary function.
curry3 <A , B , C , D > (D function (A a , B b , C c ) )
→ D Function(C c ) Function(B b ) Function(A a )
Converts a ternary function into unary functions.
curry4 <A , B , C , D , E > (E function (A a , B b , C c , D d ) )
→ E Function(D d ) Function(C c ) Function(B b ) Function(A a )
Converts a 4 parameters function into unary functions.
curry5 <A , B , C , D , E , F > (F function (A a , B b , C c , D d , E e ) )
→ F Function(E e ) Function(D d ) Function(C c ) Function(B b ) Function(A a )
Converts a 5 parameters function into unary functions.
dateNow ()
→ IO <DateTime >
Constructs a DateTime instance with current date and time in the local time zone.
dualEndoMonoid <A > ()
→ Monoid <Endo <A > >
endoMonoid <A > ()
→ Monoid <Endo <A > >
id <T > (T a )
→ T
Returns the given a
.
identity <T > (T a )
→ T
Returns the given a
.
identityFuture <T > (T a )
→ Future <T >
Returns the given a
, wrapped in Future.value
.
idFirst <T1 , T2 > (T1 t1 , T2 t2 )
→ T1
Returns the first parameter from a function that takes two parameters as input.
idFuture <T > (T a )
→ Future <T >
Returns the given a
, wrapped in Future.value
.
idSecond <T1 , T2 > (T1 t1 , T2 t2 )
→ T2
Returns the second parameter from a function that takes two parameters as input.
left <L , R > (L l )
→ Either <L , R >
Return a Left(l)
.
modifyIORef <T > (Endo <T > update , IORef <T > ref )
→ IO <Unit >
Works almost identical to the write
method, but instead of taking
a value that needs to be written, takes an Endo function, applies the
IORef 's current value to it and writes the result to the IORef .
modifyIORefC <T > (Endo <T > update )
→ IO <Unit > Function(IORef <T > ref )
A curried version of the
modifyIORef
newIORef <T > (T initial )
→ IO <IORef <T > >
Creates a new IORef inside an IO monad with a given initial value.
none <T > ()
→ Option <T >
Return a None .
now ()
→ IO <int >
The number of milliseconds since the "Unix epoch" 1970-01-01T00:00:00Z (UTC).
option <T > (T value , bool predicate (T ) )
→ Option <T >
Return Some of value
when predicate
applied to value
returns true
,
None otherwise.
optionOf <T > (T? t )
→ Option <T >
Return None if t
is null
, Some otherwise.
random ()
→ IO <double >
Generates a non-negative random floating point
value uniformly distributed in the range from 0.0, inclusive , to 1.0, exclusive .
randomBool ()
→ IO <bool >
Generates a random boolean value.
randomInt (int min , int max )
→ IO <int >
Generates a non-negative random integer uniformly distributed
in the range from min
, inclusive , to max
, exclusive .
readIORef <T > (IORef <T > ref )
→ IO <T >
Extracts a current value of the IORef and returns it inside the
IO monad.
right <L , R > (R r )
→ Either <L , R >
Return a Right(r)
.
runServer (AppModule appModule , {String ? host , int ? port })
→ Future <void >
Starts a server with an AppModule. Default port and host are: 8080 and "0.0.0.0"
some <T > (T t )
→ Option <T >
Return a Some(t)
.
tuple2 <A , B > (A a , B b )
→ Tuple2 <A , B >
Return a Tuple2(a, b)
.
tuple2CurriedFirst <A , B > (A a )
→ Tuple2 <A , B > Function(B b )
Build a Tuple2(a, b)
using a curried function in which the first function
accepts a
and the second function accepts b
.
tuple2CurriedSecond <A , B > (B b )
→ Tuple2 <A , B > Function(A a )
Build a Tuple2(a, b)
using a curried function in which the first function
accepts b
and the second function accepts a
.
uncurry2 <A , B , C > (C Function(B a ) function (A a ) )
→ C Function(A a , B b )
Converts a unary function that returns a unary function into a binary function.
uncurry3 <A , B , C , D > (D Function(C c ) Function(B b ) function (A a ) )
→ D Function(A a , B b , C c )
Converts a series of unary functions into a ternary function.
uncurry4 <A , B , C , D , E > (E Function(D d ) Function(C c ) Function(B b ) function (A a ) )
→ E Function(A a , B b , C c , D d )
Converts a series of unary functions into a 4 parameters function.
uncurry5 <A , B , C , D , E , F > (F Function(E e ) Function(D d ) Function(C c ) Function(B b ) function (A a ) )
→ F Function(A a , B b , C c , D d , E e )
Converts a series of unary functions into a 5 parameters function.
writeIORef <T > (T value , IORef <T > ref )
→ IO <Unit >
Writes the given value to the IORef and returns a Unit inside the
IO monad.
writeIORefC <T > (T value )
→ IO <Unit > Function(IORef <T > ref )
A curried version of the
writeIORef