url
stringlengths
11
2.25k
text
stringlengths
88
50k
ts
timestamp[s]date
2026-01-13 08:47:33
2026-01-13 09:30:40
http://hackage.haskell.org/package/semigroupoids-4.2/docs/Data-Functor-Apply.html#g:2
Data.Functor.Apply Source Contents Index semigroupoids-4.2: Semigroupoids: Category sans id Portability portable Stability provisional Maintainer Edward Kmett <ekmett@gmail.com> Safe Haskell Safe Data.Functor.Apply Contents Functors Apply - a strong lax semimonoidal endofunctor Wrappers Description   Synopsis class Functor f where fmap :: (a -> b) -> f a -> f b (<$) :: a -> f b -> f a (<$>) :: Functor f => (a -> b) -> f a -> f b ($>) :: Functor f => f a -> b -> f b class Functor f => Apply f where (<.>) :: f (a -> b) -> f a -> f b (.>) :: f a -> f b -> f b (<.) :: f a -> f b -> f a (<..>) :: Apply w => w a -> w (a -> b) -> w b liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d newtype WrappedApplicative f a = WrapApplicative { unwrapApplicative :: f a } newtype MaybeApply f a = MaybeApply { runMaybeApply :: Either (f a) a } Functors class Functor f where The Functor class is used for types that can be mapped over. Instances of Functor should satisfy the following laws: fmap id == id fmap (f . g) == fmap f . fmap g The instances of Functor for lists, Maybe and IO satisfy these laws. Methods fmap :: (a -> b) -> f a -> f b (<$) :: a -> f b -> f a Replace all locations in the input with the same value. The default definition is fmap . const , but this may be overridden with a more efficient version. Instances Functor []   Functor IO   Functor Id   Functor ZipList   Functor Handler   Functor STM   Functor ReadPrec   Functor ReadP   Functor Maybe   Functor Identity   Functor Digit   Functor Node   Functor Elem   Functor Id   Functor FingerTree   Functor Tree   Functor Seq   Functor ViewL   Functor ViewR   Functor IntMap   Functor Min   Functor Max   Functor First   Functor Last   Functor Option   Functor NonEmpty   Functor ((->) r)   Functor ( Either a)   Functor ( (,) a)   Functor ( ST s)   Functor (StateL s)   Functor (StateR s)   Functor ( Const m)   Monad m => Functor ( WrappedMonad m)   Functor ( ST s)   Arrow a => Functor ( ArrowMonad a)   Functor m => Functor ( IdentityT m)   Functor (State s)   Functor ( Map k)   Functor m => Functor ( MaybeT m)   Functor m => Functor ( ListT m)   Functor ( HashMap k)   Functor f => Functor ( MaybeApply f)   Functor f => Functor ( WrappedApplicative f)   Arrow a => Functor ( WrappedArrow a b)   ( Functor f, Functor g) => Functor ( Coproduct f g)   Functor w => Functor ( TracedT m w)   Functor w => Functor ( StoreT s w)   Functor w => Functor ( EnvT e w)   Functor ( Cokleisli w a)   ( Functor f, Functor g) => Functor ( Product f g)   ( Functor f, Functor g) => Functor ( Compose f g)   Functor m => Functor ( WriterT w m)   Functor m => Functor ( WriterT w m)   Functor m => Functor ( ErrorT e m)   Functor m => Functor ( StateT s m)   Functor m => Functor ( StateT s m)   Functor m => Functor ( ReaderT r m)   Functor ( ContT r m)   Functor f => Functor ( Static f a)   Functor m => Functor ( RWST r w s m)   Functor m => Functor ( RWST r w s m)   (<$>) :: Functor f => (a -> b) -> f a -> f b An infix synonym for fmap . ($>) :: Functor f => f a -> b -> f b Replace the contents of a functor uniformly with a constant value. Apply - a strong lax semimonoidal endofunctor class Functor f => Apply f where Source A strong lax semi-monoidal endofunctor. This is equivalent to an Applicative without pure . Laws: associative composition: (.) <$> u <.> v <.> w = u <.> (v <.> w) Methods (<.>) :: f (a -> b) -> f a -> f b Source (.>) :: f a -> f b -> f b Source a .> b = const id <$> a <.> b (<.) :: f a -> f b -> f a Source a <. b = const <$> a <.> b Instances Apply []   Apply IO   Apply ZipList   Apply Maybe   Apply Identity   Apply Tree   Apply Seq   Apply IntMap An IntMap is not Applicative , but it is an instance of Apply Apply Option   Apply NonEmpty   Apply ((->) m)   Apply ( Either a)   Semigroup m => Apply ( (,) m)   Semigroup m => Apply ( Const m)   Monad m => Apply ( WrappedMonad m)   Apply w => Apply ( IdentityT w)   Ord k => Apply ( Map k) A Map is not Applicative , but it is an instance of Apply ( Bind m, Monad m) => Apply ( MaybeT m)   Apply m => Apply ( ListT m)   Apply f => Apply ( MaybeApply f)   Applicative f => Apply ( WrappedApplicative f)   Arrow a => Apply ( WrappedArrow a b)   Apply w => Apply ( TracedT m w)   ( Apply w, Semigroup s) => Apply ( StoreT s w)   ( Semigroup e, Apply w) => Apply ( EnvT e w)   Apply ( Cokleisli w a)   ( Apply f, Apply g) => Apply ( Product f g)   ( Apply f, Apply g) => Apply ( Compose f g)   ( Apply m, Semigroup w) => Apply ( WriterT w m)   ( Apply m, Semigroup w) => Apply ( WriterT w m)   ( Bind m, Monad m) => Apply ( ErrorT e m)   Bind m => Apply ( StateT s m)   Bind m => Apply ( StateT s m)   Apply m => Apply ( ReaderT e m)   Apply ( ContT r m)   Apply f => Apply ( Static f a)   ( Bind m, Semigroup w) => Apply ( RWST r w s m)   ( Bind m, Semigroup w) => Apply ( RWST r w s m)   (<..>) :: Apply w => w a -> w (a -> b) -> w b Source A variant of <.> with the arguments reversed. liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c Source Lift a binary function into a comonad with zipping liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d Source Lift a ternary function into a comonad with zipping Wrappers newtype WrappedApplicative f a Source Wrap an Applicative to be used as a member of Apply Constructors WrapApplicative   Fields unwrapApplicative :: f a   Instances Functor f => Functor ( WrappedApplicative f)   Applicative f => Applicative ( WrappedApplicative f)   Alternative f => Alternative ( WrappedApplicative f)   Applicative f => Apply ( WrappedApplicative f)   Alternative f => Alt ( WrappedApplicative f)   Alternative f => Plus ( WrappedApplicative f)   newtype MaybeApply f a Source Transform a Apply into an Applicative by adding a unit. Constructors MaybeApply   Fields runMaybeApply :: Either (f a) a   Instances Functor f => Functor ( MaybeApply f)   Apply f => Applicative ( MaybeApply f)   Comonad f => Comonad ( MaybeApply f)   Extend f => Extend ( MaybeApply f)   Apply f => Apply ( MaybeApply f)   Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Applicative.html#t:Const
Control.Applicative Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability experimental Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Applicative Contents Applicative functors Alternatives Instances Utility functions Description This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads, this interface lacks the full power of the binding operation >>= , but it has more instances. it is sufficient for many uses, e.g. context-free parsing, or the Traversable class. instances can perform analysis of computations before they are executed, and thus produce shared optimizations. This interface was introduced for parsers by Niklas Röjemo, because it admits more sharing than the monadic interface. The names here are mostly based on parsing work by Doaitse Swierstra. For more details, see Applicative Programming with Effects , by Conor McBride and Ross Paterson, online at http://www.soi.city.ac.uk/~ross/papers/Applicative.html . Synopsis class Functor f => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b (*>) :: f a -> f b -> f b (<*) :: f a -> f b -> f a class Applicative f => Alternative f where empty :: f a (<|>) :: f a -> f a -> f a some :: f a -> f [a] many :: f a -> f [a] newtype Const a b = Const { getConst :: a } newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a } newtype WrappedArrow a b c = WrapArrow { unwrapArrow :: a b c } newtype ZipList a = ZipList { getZipList :: [a] } (<$>) :: Functor f => (a -> b) -> f a -> f b (<$) :: Functor f => a -> f b -> f a (<**>) :: Applicative f => f a -> f (a -> b) -> f b liftA :: Applicative f => (a -> b) -> f a -> f b liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d optional :: Alternative f => f a -> f ( Maybe a) Applicative functors class Functor f => Applicative f where Source A functor with application, providing operations to embed pure expressions ( pure ), and sequence computations and combine their results ( <*> ). A minimal complete definition must include implementations of these functions satisfying the following laws: identity pure id <*> v = v composition pure (.) <*> u <*> v <*> w = u <*> (v <*> w) homomorphism pure f <*> pure x = pure (f x) interchange u <*> pure y = pure ( $ y) <*> u The other methods have the following default definitions, which may be overridden with equivalent specialized implementations: u *> v = pure ( const id ) <*> u <*> v u <* v = pure const <*> u <*> v As a consequence of these laws, the Functor instance for f will satisfy fmap f x = pure f <*> x If f is also a Monad , it should satisfy pure = return and ( <*> ) = ap (which implies that pure and <*> satisfy the applicative functor laws). Methods pure :: a -> f a Source Lift a value. (<*>) :: f (a -> b) -> f a -> f b Source Sequential application. (*>) :: f a -> f b -> f b Source Sequence actions, discarding the value of the first argument. (<*) :: f a -> f b -> f a Source Sequence actions, discarding the value of the second argument. Instances Applicative []   Applicative IO   Applicative Maybe   Applicative ReadP   Applicative ReadPrec   Applicative STM   Applicative ZipList   Applicative ((->) a)   Applicative ( Either e)   Monoid a => Applicative ( (,) a)   Applicative ( ST s)   Arrow a => Applicative ( ArrowMonad a)   Applicative ( ST s)   Monad m => Applicative ( WrappedMonad m)   Monoid m => Applicative ( Const m)   Arrow a => Applicative ( WrappedArrow a b)   Alternatives class Applicative f => Alternative f where Source A monoid on applicative functors. Minimal complete definition: empty and <|> . If defined, some and many should be the least solutions of the equations: some v = (:) <$> v <*> many v many v = some v <|> pure [] Methods empty :: f a Source The identity of <|> (<|>) :: f a -> f a -> f a Source An associative binary operation some :: f a -> f [a] Source One or more. many :: f a -> f [a] Source Zero or more. Instances Alternative []   Alternative Maybe   Alternative ReadP   Alternative ReadPrec   Alternative STM   ArrowPlus a => Alternative ( ArrowMonad a)   MonadPlus m => Alternative ( WrappedMonad m)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   Instances newtype Const a b Source Constructors Const   Fields getConst :: a   Instances Functor ( Const m)   Monoid m => Applicative ( Const m)   newtype WrappedMonad m a Source Constructors WrapMonad   Fields unwrapMonad :: m a   Instances Monad m => Functor ( WrappedMonad m)   Monad m => Applicative ( WrappedMonad m)   MonadPlus m => Alternative ( WrappedMonad m)   newtype WrappedArrow a b c Source Constructors WrapArrow   Fields unwrapArrow :: a b c   Instances Arrow a => Functor ( WrappedArrow a b)   Arrow a => Applicative ( WrappedArrow a b)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   newtype ZipList a Source Lists, but with an Applicative functor based on zipping, so that f <$> ZipList xs1 <*> ... <*> ZipList xsn = ZipList (zipWithn f xs1 ... xsn) Constructors ZipList   Fields getZipList :: [a]   Instances Functor ZipList   Applicative ZipList   Utility functions (<$>) :: Functor f => (a -> b) -> f a -> f b Source An infix synonym for fmap . (<$) :: Functor f => a -> f b -> f a Source Replace all locations in the input with the same value. The default definition is fmap . const , but this may be overridden with a more efficient version. (<**>) :: Applicative f => f a -> f (a -> b) -> f b Source A variant of <*> with the arguments reversed. liftA :: Applicative f => (a -> b) -> f a -> f b Source Lift a function to actions. This function may be used as a value for fmap in a Functor instance. liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c Source Lift a binary function to actions. liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d Source Lift a ternary function to actions. optional :: Alternative f => f a -> f ( Maybe a) Source One or none. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Applicative.html#v:empty
Control.Applicative Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability experimental Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Applicative Contents Applicative functors Alternatives Instances Utility functions Description This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads, this interface lacks the full power of the binding operation >>= , but it has more instances. it is sufficient for many uses, e.g. context-free parsing, or the Traversable class. instances can perform analysis of computations before they are executed, and thus produce shared optimizations. This interface was introduced for parsers by Niklas Röjemo, because it admits more sharing than the monadic interface. The names here are mostly based on parsing work by Doaitse Swierstra. For more details, see Applicative Programming with Effects , by Conor McBride and Ross Paterson, online at http://www.soi.city.ac.uk/~ross/papers/Applicative.html . Synopsis class Functor f => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b (*>) :: f a -> f b -> f b (<*) :: f a -> f b -> f a class Applicative f => Alternative f where empty :: f a (<|>) :: f a -> f a -> f a some :: f a -> f [a] many :: f a -> f [a] newtype Const a b = Const { getConst :: a } newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a } newtype WrappedArrow a b c = WrapArrow { unwrapArrow :: a b c } newtype ZipList a = ZipList { getZipList :: [a] } (<$>) :: Functor f => (a -> b) -> f a -> f b (<$) :: Functor f => a -> f b -> f a (<**>) :: Applicative f => f a -> f (a -> b) -> f b liftA :: Applicative f => (a -> b) -> f a -> f b liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d optional :: Alternative f => f a -> f ( Maybe a) Applicative functors class Functor f => Applicative f where Source A functor with application, providing operations to embed pure expressions ( pure ), and sequence computations and combine their results ( <*> ). A minimal complete definition must include implementations of these functions satisfying the following laws: identity pure id <*> v = v composition pure (.) <*> u <*> v <*> w = u <*> (v <*> w) homomorphism pure f <*> pure x = pure (f x) interchange u <*> pure y = pure ( $ y) <*> u The other methods have the following default definitions, which may be overridden with equivalent specialized implementations: u *> v = pure ( const id ) <*> u <*> v u <* v = pure const <*> u <*> v As a consequence of these laws, the Functor instance for f will satisfy fmap f x = pure f <*> x If f is also a Monad , it should satisfy pure = return and ( <*> ) = ap (which implies that pure and <*> satisfy the applicative functor laws). Methods pure :: a -> f a Source Lift a value. (<*>) :: f (a -> b) -> f a -> f b Source Sequential application. (*>) :: f a -> f b -> f b Source Sequence actions, discarding the value of the first argument. (<*) :: f a -> f b -> f a Source Sequence actions, discarding the value of the second argument. Instances Applicative []   Applicative IO   Applicative Maybe   Applicative ReadP   Applicative ReadPrec   Applicative STM   Applicative ZipList   Applicative ((->) a)   Applicative ( Either e)   Monoid a => Applicative ( (,) a)   Applicative ( ST s)   Arrow a => Applicative ( ArrowMonad a)   Applicative ( ST s)   Monad m => Applicative ( WrappedMonad m)   Monoid m => Applicative ( Const m)   Arrow a => Applicative ( WrappedArrow a b)   Alternatives class Applicative f => Alternative f where Source A monoid on applicative functors. Minimal complete definition: empty and <|> . If defined, some and many should be the least solutions of the equations: some v = (:) <$> v <*> many v many v = some v <|> pure [] Methods empty :: f a Source The identity of <|> (<|>) :: f a -> f a -> f a Source An associative binary operation some :: f a -> f [a] Source One or more. many :: f a -> f [a] Source Zero or more. Instances Alternative []   Alternative Maybe   Alternative ReadP   Alternative ReadPrec   Alternative STM   ArrowPlus a => Alternative ( ArrowMonad a)   MonadPlus m => Alternative ( WrappedMonad m)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   Instances newtype Const a b Source Constructors Const   Fields getConst :: a   Instances Functor ( Const m)   Monoid m => Applicative ( Const m)   newtype WrappedMonad m a Source Constructors WrapMonad   Fields unwrapMonad :: m a   Instances Monad m => Functor ( WrappedMonad m)   Monad m => Applicative ( WrappedMonad m)   MonadPlus m => Alternative ( WrappedMonad m)   newtype WrappedArrow a b c Source Constructors WrapArrow   Fields unwrapArrow :: a b c   Instances Arrow a => Functor ( WrappedArrow a b)   Arrow a => Applicative ( WrappedArrow a b)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   newtype ZipList a Source Lists, but with an Applicative functor based on zipping, so that f <$> ZipList xs1 <*> ... <*> ZipList xsn = ZipList (zipWithn f xs1 ... xsn) Constructors ZipList   Fields getZipList :: [a]   Instances Functor ZipList   Applicative ZipList   Utility functions (<$>) :: Functor f => (a -> b) -> f a -> f b Source An infix synonym for fmap . (<$) :: Functor f => a -> f b -> f a Source Replace all locations in the input with the same value. The default definition is fmap . const , but this may be overridden with a more efficient version. (<**>) :: Applicative f => f a -> f (a -> b) -> f b Source A variant of <*> with the arguments reversed. liftA :: Applicative f => (a -> b) -> f a -> f b Source Lift a function to actions. This function may be used as a value for fmap in a Functor instance. liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c Source Lift a binary function to actions. liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d Source Lift a ternary function to actions. optional :: Alternative f => f a -> f ( Maybe a) Source One or none. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Applicative.html#t:Alternative
Control.Applicative Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability experimental Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Applicative Contents Applicative functors Alternatives Instances Utility functions Description This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads, this interface lacks the full power of the binding operation >>= , but it has more instances. it is sufficient for many uses, e.g. context-free parsing, or the Traversable class. instances can perform analysis of computations before they are executed, and thus produce shared optimizations. This interface was introduced for parsers by Niklas Röjemo, because it admits more sharing than the monadic interface. The names here are mostly based on parsing work by Doaitse Swierstra. For more details, see Applicative Programming with Effects , by Conor McBride and Ross Paterson, online at http://www.soi.city.ac.uk/~ross/papers/Applicative.html . Synopsis class Functor f => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b (*>) :: f a -> f b -> f b (<*) :: f a -> f b -> f a class Applicative f => Alternative f where empty :: f a (<|>) :: f a -> f a -> f a some :: f a -> f [a] many :: f a -> f [a] newtype Const a b = Const { getConst :: a } newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a } newtype WrappedArrow a b c = WrapArrow { unwrapArrow :: a b c } newtype ZipList a = ZipList { getZipList :: [a] } (<$>) :: Functor f => (a -> b) -> f a -> f b (<$) :: Functor f => a -> f b -> f a (<**>) :: Applicative f => f a -> f (a -> b) -> f b liftA :: Applicative f => (a -> b) -> f a -> f b liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d optional :: Alternative f => f a -> f ( Maybe a) Applicative functors class Functor f => Applicative f where Source A functor with application, providing operations to embed pure expressions ( pure ), and sequence computations and combine their results ( <*> ). A minimal complete definition must include implementations of these functions satisfying the following laws: identity pure id <*> v = v composition pure (.) <*> u <*> v <*> w = u <*> (v <*> w) homomorphism pure f <*> pure x = pure (f x) interchange u <*> pure y = pure ( $ y) <*> u The other methods have the following default definitions, which may be overridden with equivalent specialized implementations: u *> v = pure ( const id ) <*> u <*> v u <* v = pure const <*> u <*> v As a consequence of these laws, the Functor instance for f will satisfy fmap f x = pure f <*> x If f is also a Monad , it should satisfy pure = return and ( <*> ) = ap (which implies that pure and <*> satisfy the applicative functor laws). Methods pure :: a -> f a Source Lift a value. (<*>) :: f (a -> b) -> f a -> f b Source Sequential application. (*>) :: f a -> f b -> f b Source Sequence actions, discarding the value of the first argument. (<*) :: f a -> f b -> f a Source Sequence actions, discarding the value of the second argument. Instances Applicative []   Applicative IO   Applicative Maybe   Applicative ReadP   Applicative ReadPrec   Applicative STM   Applicative ZipList   Applicative ((->) a)   Applicative ( Either e)   Monoid a => Applicative ( (,) a)   Applicative ( ST s)   Arrow a => Applicative ( ArrowMonad a)   Applicative ( ST s)   Monad m => Applicative ( WrappedMonad m)   Monoid m => Applicative ( Const m)   Arrow a => Applicative ( WrappedArrow a b)   Alternatives class Applicative f => Alternative f where Source A monoid on applicative functors. Minimal complete definition: empty and <|> . If defined, some and many should be the least solutions of the equations: some v = (:) <$> v <*> many v many v = some v <|> pure [] Methods empty :: f a Source The identity of <|> (<|>) :: f a -> f a -> f a Source An associative binary operation some :: f a -> f [a] Source One or more. many :: f a -> f [a] Source Zero or more. Instances Alternative []   Alternative Maybe   Alternative ReadP   Alternative ReadPrec   Alternative STM   ArrowPlus a => Alternative ( ArrowMonad a)   MonadPlus m => Alternative ( WrappedMonad m)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   Instances newtype Const a b Source Constructors Const   Fields getConst :: a   Instances Functor ( Const m)   Monoid m => Applicative ( Const m)   newtype WrappedMonad m a Source Constructors WrapMonad   Fields unwrapMonad :: m a   Instances Monad m => Functor ( WrappedMonad m)   Monad m => Applicative ( WrappedMonad m)   MonadPlus m => Alternative ( WrappedMonad m)   newtype WrappedArrow a b c Source Constructors WrapArrow   Fields unwrapArrow :: a b c   Instances Arrow a => Functor ( WrappedArrow a b)   Arrow a => Applicative ( WrappedArrow a b)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   newtype ZipList a Source Lists, but with an Applicative functor based on zipping, so that f <$> ZipList xs1 <*> ... <*> ZipList xsn = ZipList (zipWithn f xs1 ... xsn) Constructors ZipList   Fields getZipList :: [a]   Instances Functor ZipList   Applicative ZipList   Utility functions (<$>) :: Functor f => (a -> b) -> f a -> f b Source An infix synonym for fmap . (<$) :: Functor f => a -> f b -> f a Source Replace all locations in the input with the same value. The default definition is fmap . const , but this may be overridden with a more efficient version. (<**>) :: Applicative f => f a -> f (a -> b) -> f b Source A variant of <*> with the arguments reversed. liftA :: Applicative f => (a -> b) -> f a -> f b Source Lift a function to actions. This function may be used as a value for fmap in a Functor instance. liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c Source Lift a binary function to actions. liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d Source Lift a ternary function to actions. optional :: Alternative f => f a -> f ( Maybe a) Source One or none. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Applicative.html#t:ZipList
Control.Applicative Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability experimental Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Applicative Contents Applicative functors Alternatives Instances Utility functions Description This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads, this interface lacks the full power of the binding operation >>= , but it has more instances. it is sufficient for many uses, e.g. context-free parsing, or the Traversable class. instances can perform analysis of computations before they are executed, and thus produce shared optimizations. This interface was introduced for parsers by Niklas Röjemo, because it admits more sharing than the monadic interface. The names here are mostly based on parsing work by Doaitse Swierstra. For more details, see Applicative Programming with Effects , by Conor McBride and Ross Paterson, online at http://www.soi.city.ac.uk/~ross/papers/Applicative.html . Synopsis class Functor f => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b (*>) :: f a -> f b -> f b (<*) :: f a -> f b -> f a class Applicative f => Alternative f where empty :: f a (<|>) :: f a -> f a -> f a some :: f a -> f [a] many :: f a -> f [a] newtype Const a b = Const { getConst :: a } newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a } newtype WrappedArrow a b c = WrapArrow { unwrapArrow :: a b c } newtype ZipList a = ZipList { getZipList :: [a] } (<$>) :: Functor f => (a -> b) -> f a -> f b (<$) :: Functor f => a -> f b -> f a (<**>) :: Applicative f => f a -> f (a -> b) -> f b liftA :: Applicative f => (a -> b) -> f a -> f b liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d optional :: Alternative f => f a -> f ( Maybe a) Applicative functors class Functor f => Applicative f where Source A functor with application, providing operations to embed pure expressions ( pure ), and sequence computations and combine their results ( <*> ). A minimal complete definition must include implementations of these functions satisfying the following laws: identity pure id <*> v = v composition pure (.) <*> u <*> v <*> w = u <*> (v <*> w) homomorphism pure f <*> pure x = pure (f x) interchange u <*> pure y = pure ( $ y) <*> u The other methods have the following default definitions, which may be overridden with equivalent specialized implementations: u *> v = pure ( const id ) <*> u <*> v u <* v = pure const <*> u <*> v As a consequence of these laws, the Functor instance for f will satisfy fmap f x = pure f <*> x If f is also a Monad , it should satisfy pure = return and ( <*> ) = ap (which implies that pure and <*> satisfy the applicative functor laws). Methods pure :: a -> f a Source Lift a value. (<*>) :: f (a -> b) -> f a -> f b Source Sequential application. (*>) :: f a -> f b -> f b Source Sequence actions, discarding the value of the first argument. (<*) :: f a -> f b -> f a Source Sequence actions, discarding the value of the second argument. Instances Applicative []   Applicative IO   Applicative Maybe   Applicative ReadP   Applicative ReadPrec   Applicative STM   Applicative ZipList   Applicative ((->) a)   Applicative ( Either e)   Monoid a => Applicative ( (,) a)   Applicative ( ST s)   Arrow a => Applicative ( ArrowMonad a)   Applicative ( ST s)   Monad m => Applicative ( WrappedMonad m)   Monoid m => Applicative ( Const m)   Arrow a => Applicative ( WrappedArrow a b)   Alternatives class Applicative f => Alternative f where Source A monoid on applicative functors. Minimal complete definition: empty and <|> . If defined, some and many should be the least solutions of the equations: some v = (:) <$> v <*> many v many v = some v <|> pure [] Methods empty :: f a Source The identity of <|> (<|>) :: f a -> f a -> f a Source An associative binary operation some :: f a -> f [a] Source One or more. many :: f a -> f [a] Source Zero or more. Instances Alternative []   Alternative Maybe   Alternative ReadP   Alternative ReadPrec   Alternative STM   ArrowPlus a => Alternative ( ArrowMonad a)   MonadPlus m => Alternative ( WrappedMonad m)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   Instances newtype Const a b Source Constructors Const   Fields getConst :: a   Instances Functor ( Const m)   Monoid m => Applicative ( Const m)   newtype WrappedMonad m a Source Constructors WrapMonad   Fields unwrapMonad :: m a   Instances Monad m => Functor ( WrappedMonad m)   Monad m => Applicative ( WrappedMonad m)   MonadPlus m => Alternative ( WrappedMonad m)   newtype WrappedArrow a b c Source Constructors WrapArrow   Fields unwrapArrow :: a b c   Instances Arrow a => Functor ( WrappedArrow a b)   Arrow a => Applicative ( WrappedArrow a b)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   newtype ZipList a Source Lists, but with an Applicative functor based on zipping, so that f <$> ZipList xs1 <*> ... <*> ZipList xsn = ZipList (zipWithn f xs1 ... xsn) Constructors ZipList   Fields getZipList :: [a]   Instances Functor ZipList   Applicative ZipList   Utility functions (<$>) :: Functor f => (a -> b) -> f a -> f b Source An infix synonym for fmap . (<$) :: Functor f => a -> f b -> f a Source Replace all locations in the input with the same value. The default definition is fmap . const , but this may be overridden with a more efficient version. (<**>) :: Applicative f => f a -> f (a -> b) -> f b Source A variant of <*> with the arguments reversed. liftA :: Applicative f => (a -> b) -> f a -> f b Source Lift a function to actions. This function may be used as a value for fmap in a Functor instance. liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c Source Lift a binary function to actions. liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d Source Lift a ternary function to actions. optional :: Alternative f => f a -> f ( Maybe a) Source One or none. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Applicative.html#t:Applicative
Control.Applicative Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability experimental Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Applicative Contents Applicative functors Alternatives Instances Utility functions Description This module describes a structure intermediate between a functor and a monad (technically, a strong lax monoidal functor). Compared with monads, this interface lacks the full power of the binding operation >>= , but it has more instances. it is sufficient for many uses, e.g. context-free parsing, or the Traversable class. instances can perform analysis of computations before they are executed, and thus produce shared optimizations. This interface was introduced for parsers by Niklas Röjemo, because it admits more sharing than the monadic interface. The names here are mostly based on parsing work by Doaitse Swierstra. For more details, see Applicative Programming with Effects , by Conor McBride and Ross Paterson, online at http://www.soi.city.ac.uk/~ross/papers/Applicative.html . Synopsis class Functor f => Applicative f where pure :: a -> f a (<*>) :: f (a -> b) -> f a -> f b (*>) :: f a -> f b -> f b (<*) :: f a -> f b -> f a class Applicative f => Alternative f where empty :: f a (<|>) :: f a -> f a -> f a some :: f a -> f [a] many :: f a -> f [a] newtype Const a b = Const { getConst :: a } newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a } newtype WrappedArrow a b c = WrapArrow { unwrapArrow :: a b c } newtype ZipList a = ZipList { getZipList :: [a] } (<$>) :: Functor f => (a -> b) -> f a -> f b (<$) :: Functor f => a -> f b -> f a (<**>) :: Applicative f => f a -> f (a -> b) -> f b liftA :: Applicative f => (a -> b) -> f a -> f b liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d optional :: Alternative f => f a -> f ( Maybe a) Applicative functors class Functor f => Applicative f where Source A functor with application, providing operations to embed pure expressions ( pure ), and sequence computations and combine their results ( <*> ). A minimal complete definition must include implementations of these functions satisfying the following laws: identity pure id <*> v = v composition pure (.) <*> u <*> v <*> w = u <*> (v <*> w) homomorphism pure f <*> pure x = pure (f x) interchange u <*> pure y = pure ( $ y) <*> u The other methods have the following default definitions, which may be overridden with equivalent specialized implementations: u *> v = pure ( const id ) <*> u <*> v u <* v = pure const <*> u <*> v As a consequence of these laws, the Functor instance for f will satisfy fmap f x = pure f <*> x If f is also a Monad , it should satisfy pure = return and ( <*> ) = ap (which implies that pure and <*> satisfy the applicative functor laws). Methods pure :: a -> f a Source Lift a value. (<*>) :: f (a -> b) -> f a -> f b Source Sequential application. (*>) :: f a -> f b -> f b Source Sequence actions, discarding the value of the first argument. (<*) :: f a -> f b -> f a Source Sequence actions, discarding the value of the second argument. Instances Applicative []   Applicative IO   Applicative Maybe   Applicative ReadP   Applicative ReadPrec   Applicative STM   Applicative ZipList   Applicative ((->) a)   Applicative ( Either e)   Monoid a => Applicative ( (,) a)   Applicative ( ST s)   Arrow a => Applicative ( ArrowMonad a)   Applicative ( ST s)   Monad m => Applicative ( WrappedMonad m)   Monoid m => Applicative ( Const m)   Arrow a => Applicative ( WrappedArrow a b)   Alternatives class Applicative f => Alternative f where Source A monoid on applicative functors. Minimal complete definition: empty and <|> . If defined, some and many should be the least solutions of the equations: some v = (:) <$> v <*> many v many v = some v <|> pure [] Methods empty :: f a Source The identity of <|> (<|>) :: f a -> f a -> f a Source An associative binary operation some :: f a -> f [a] Source One or more. many :: f a -> f [a] Source Zero or more. Instances Alternative []   Alternative Maybe   Alternative ReadP   Alternative ReadPrec   Alternative STM   ArrowPlus a => Alternative ( ArrowMonad a)   MonadPlus m => Alternative ( WrappedMonad m)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   Instances newtype Const a b Source Constructors Const   Fields getConst :: a   Instances Functor ( Const m)   Monoid m => Applicative ( Const m)   newtype WrappedMonad m a Source Constructors WrapMonad   Fields unwrapMonad :: m a   Instances Monad m => Functor ( WrappedMonad m)   Monad m => Applicative ( WrappedMonad m)   MonadPlus m => Alternative ( WrappedMonad m)   newtype WrappedArrow a b c Source Constructors WrapArrow   Fields unwrapArrow :: a b c   Instances Arrow a => Functor ( WrappedArrow a b)   Arrow a => Applicative ( WrappedArrow a b)   ( ArrowZero a, ArrowPlus a) => Alternative ( WrappedArrow a b)   newtype ZipList a Source Lists, but with an Applicative functor based on zipping, so that f <$> ZipList xs1 <*> ... <*> ZipList xsn = ZipList (zipWithn f xs1 ... xsn) Constructors ZipList   Fields getZipList :: [a]   Instances Functor ZipList   Applicative ZipList   Utility functions (<$>) :: Functor f => (a -> b) -> f a -> f b Source An infix synonym for fmap . (<$) :: Functor f => a -> f b -> f a Source Replace all locations in the input with the same value. The default definition is fmap . const , but this may be overridden with a more efficient version. (<**>) :: Applicative f => f a -> f (a -> b) -> f b Source A variant of <*> with the arguments reversed. liftA :: Applicative f => (a -> b) -> f a -> f b Source Lift a function to actions. This function may be used as a value for fmap in a Functor instance. liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c Source Lift a binary function to actions. liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d Source Lift a ternary function to actions. optional :: Alternative f => f a -> f ( Maybe a) Source One or none. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Isomorphism.html
src/Data/Isomorphism.hs {-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} #endif module Data . Isomorphism ( Iso ( .. ) ) where import Data . Semigroupoid import Data . Groupoid import Control . Category import Prelude () data Iso k a b = Iso { embed :: k a b , project :: k b a } instance Semigroupoid k => Semigroupoid ( Iso k ) where Iso f g `o` Iso h i = Iso ( f `o` h ) ( i `o` g ) instance Semigroupoid k => Groupoid ( Iso k ) where inv ( Iso f g ) = Iso g f instance Category k => Category ( Iso k ) where Iso f g . Iso h i = Iso ( f . h ) ( i . g ) id = Iso id id
2026-01-13T09:30:24
http://hackage.haskell.org/package/containers-0.5.0.0/docs/Data-Tree.html#t:Tree
Data.Tree Source Contents Index containers-0.5.0.0: Assorted concrete container types Portability portable Stability experimental Maintainer libraries@haskell.org Safe Haskell Safe Data.Tree Contents Two-dimensional drawing Extraction Building trees Description Multi-way trees ( aka rose trees) and forests. Synopsis data Tree a = Node { rootLabel :: a subForest :: Forest a } type Forest a = [ Tree a] drawTree :: Tree String -> String drawForest :: Forest String -> String flatten :: Tree a -> [a] levels :: Tree a -> [[a]] unfoldTree :: (b -> (a, [b])) -> b -> Tree a unfoldForest :: (b -> (a, [b])) -> [b] -> Forest a unfoldTreeM :: Monad m => (b -> m (a, [b])) -> b -> m ( Tree a) unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m ( Forest a) unfoldTreeM_BF :: Monad m => (b -> m (a, [b])) -> b -> m ( Tree a) unfoldForestM_BF :: Monad m => (b -> m (a, [b])) -> [b] -> m ( Forest a) Documentation data Tree a Source Multi-way trees, also known as rose trees . Constructors Node   Fields rootLabel :: a label value subForest :: Forest a zero or more child trees Instances Monad Tree   Functor Tree   Typeable1 Tree   Applicative Tree   Foldable Tree   Traversable Tree   Eq a => Eq ( Tree a)   Data a => Data ( Tree a)   Read a => Read ( Tree a)   Show a => Show ( Tree a)   NFData a => NFData ( Tree a)   type Forest a = [ Tree a] Source Two-dimensional drawing drawTree :: Tree String -> String Source Neat 2-dimensional drawing of a tree. drawForest :: Forest String -> String Source Neat 2-dimensional drawing of a forest. Extraction flatten :: Tree a -> [a] Source The elements of a tree in pre-order. levels :: Tree a -> [[a]] Source Lists of nodes at each level of the tree. Building trees unfoldTree :: (b -> (a, [b])) -> b -> Tree a Source Build a tree from a seed value unfoldForest :: (b -> (a, [b])) -> [b] -> Forest a Source Build a forest from a list of seed values unfoldTreeM :: Monad m => (b -> m (a, [b])) -> b -> m ( Tree a) Source Monadic tree builder, in depth-first order unfoldForestM :: Monad m => (b -> m (a, [b])) -> [b] -> m ( Forest a) Source Monadic forest builder, in depth-first order unfoldTreeM_BF :: Monad m => (b -> m (a, [b])) -> b -> m ( Tree a) Source Monadic tree builder, in breadth-first order, using an algorithm adapted from Breadth-First Numbering: Lessons from a Small Exercise in Algorithm Design , by Chris Okasaki, ICFP'00 . unfoldForestM_BF :: Monad m => (b -> m (a, [b])) -> [b] -> m ( Forest a) Source Monadic forest builder, in breadth-first order, using an algorithm adapted from Breadth-First Numbering: Lessons from a Small Exercise in Algorithm Design , by Chris Okasaki, ICFP'00 . Produced by Haddock version 2.10.0
2026-01-13T09:30:24
http://hackage.haskell.org/package/comonad-4.2.2/docs/Control-Comonad-Trans-Identity.html#t:IdentityT
Control.Comonad.Trans.Identity Source Contents Index comonad-4.2.2: Comonads Portability portable Stability provisional Maintainer Edward Kmett <ekmett@gmail.com> Safe Haskell Safe-Inferred Control.Comonad.Trans.Identity Description   Synopsis newtype IdentityT f a = IdentityT { runIdentityT :: f a } Documentation newtype IdentityT f a The trivial monad transformer, which maps a monad to an equivalent monad. Constructors IdentityT   Fields runIdentityT :: f a   Instances MonadTrans IdentityT   ComonadTrans IdentityT   ComonadHoist IdentityT   ComonadEnv e w => ComonadEnv e ( IdentityT w)   ComonadStore s w => ComonadStore s ( IdentityT w)   ComonadTraced m w => ComonadTraced m ( IdentityT w)   Monad m => Monad ( IdentityT m)   Functor m => Functor ( IdentityT m)   MonadFix m => MonadFix ( IdentityT m)   MonadPlus m => MonadPlus ( IdentityT m)   Applicative m => Applicative ( IdentityT m)   Foldable f => Foldable ( IdentityT f)   Traversable f => Traversable ( IdentityT f)   Alternative m => Alternative ( IdentityT m)   Distributive g => Distributive ( IdentityT g)   Eq1 f => Eq1 ( IdentityT f)   Ord1 f => Ord1 ( IdentityT f)   Read1 f => Read1 ( IdentityT f)   Show1 f => Show1 ( IdentityT f)   MonadIO m => MonadIO ( IdentityT m)   ComonadApply w => ComonadApply ( IdentityT w)   Comonad w => Comonad ( IdentityT w)   ( Eq1 f, Eq a) => Eq ( IdentityT f a)   ( Ord1 f, Ord a) => Ord ( IdentityT f a)   ( Read1 f, Read a) => Read ( IdentityT f a)   ( Show1 f, Show a) => Show ( IdentityT f a)   Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Semigroupoid-Coproduct.html#L
src/Data/Semigroupoid/Coproduct.hs {-# LANGUAGE GADTs, EmptyDataDecls #-} module Data . Semigroupoid . Coproduct ( L , R , Coproduct ( .. ) , distributeDualCoproduct , factorDualCoproduct ) where import Data . Semigroupoid import Data . Semigroupoid . Dual import Data . Groupoid data L a data R a data Coproduct j k a b where L :: j a b -> Coproduct j k ( L a ) ( L b ) R :: k a b -> Coproduct j k ( R a ) ( R b ) instance ( Semigroupoid j , Semigroupoid k ) => Semigroupoid ( Coproduct j k ) where L f `o` L g = L ( f `o` g ) R f `o` R g = R ( f `o` g ) _ `o` _ = error "GADT fail" instance ( Groupoid j , Groupoid k ) => Groupoid ( Coproduct j k ) where inv ( L f ) = L ( inv f ) inv ( R f ) = R ( inv f ) distributeDualCoproduct :: Dual ( Coproduct j k ) a b -> Coproduct ( Dual j ) ( Dual k ) a b distributeDualCoproduct ( Dual ( L l ) ) = L ( Dual l ) distributeDualCoproduct ( Dual ( R r ) ) = R ( Dual r ) factorDualCoproduct :: Coproduct ( Dual j ) ( Dual k ) a b -> Dual ( Coproduct j k ) a b factorDualCoproduct ( L ( Dual l ) ) = Dual ( L l ) factorDualCoproduct ( R ( Dual r ) ) = Dual ( R r )
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Semigroupoid-Coproduct.html
src/Data/Semigroupoid/Coproduct.hs {-# LANGUAGE GADTs, EmptyDataDecls #-} module Data . Semigroupoid . Coproduct ( L , R , Coproduct ( .. ) , distributeDualCoproduct , factorDualCoproduct ) where import Data . Semigroupoid import Data . Semigroupoid . Dual import Data . Groupoid data L a data R a data Coproduct j k a b where L :: j a b -> Coproduct j k ( L a ) ( L b ) R :: k a b -> Coproduct j k ( R a ) ( R b ) instance ( Semigroupoid j , Semigroupoid k ) => Semigroupoid ( Coproduct j k ) where L f `o` L g = L ( f `o` g ) R f `o` R g = R ( f `o` g ) _ `o` _ = error "GADT fail" instance ( Groupoid j , Groupoid k ) => Groupoid ( Coproduct j k ) where inv ( L f ) = L ( inv f ) inv ( R f ) = R ( inv f ) distributeDualCoproduct :: Dual ( Coproduct j k ) a b -> Coproduct ( Dual j ) ( Dual k ) a b distributeDualCoproduct ( Dual ( L l ) ) = L ( Dual l ) distributeDualCoproduct ( Dual ( R r ) ) = R ( Dual r ) factorDualCoproduct :: Coproduct ( Dual j ) ( Dual k ) a b -> Dual ( Coproduct j k ) a b factorDualCoproduct ( L ( Dual l ) ) = Dual ( L l ) factorDualCoproduct ( R ( Dual r ) ) = Dual ( R r )
2026-01-13T09:30:24
http://hackage.haskell.org/package/transformers-0.4.1.0/docs/Data-Functor-Identity.html#t:Identity
Data.Functor.Identity Source Contents Index transformers-0.4.1.0: Concrete functor and monad transformers Portability portable Stability experimental Maintainer ross@soi.city.ac.uk Safe Haskell Safe-Inferred Data.Functor.Identity Description The identity functor and monad. This trivial type constructor serves two purposes: It can be used with functions parameterized by functor or monad classes. It can be used as a base monad to which a series of monad transformers may be applied to construct a composite monad. Most monad transformer modules include the special case of applying the transformer to Identity . For example, State s is an abbreviation for StateT s Identity . Synopsis newtype Identity a = Identity { runIdentity :: a } Documentation newtype Identity a Source Identity functor and monad. (a non-strict monad) Constructors Identity   Fields runIdentity :: a   Instances Monad Identity   Functor Identity   MonadFix Identity   Applicative Identity   Foldable Identity   Traversable Identity   Show1 Identity   Read1 Identity   Ord1 Identity   Eq1 Identity   Eq a => Eq ( Identity a)   Ord a => Ord ( Identity a)   Read a => Read ( Identity a)   Show a => Show ( Identity a)   Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Semigroupoid-Coproduct.html#R
src/Data/Semigroupoid/Coproduct.hs {-# LANGUAGE GADTs, EmptyDataDecls #-} module Data . Semigroupoid . Coproduct ( L , R , Coproduct ( .. ) , distributeDualCoproduct , factorDualCoproduct ) where import Data . Semigroupoid import Data . Semigroupoid . Dual import Data . Groupoid data L a data R a data Coproduct j k a b where L :: j a b -> Coproduct j k ( L a ) ( L b ) R :: k a b -> Coproduct j k ( R a ) ( R b ) instance ( Semigroupoid j , Semigroupoid k ) => Semigroupoid ( Coproduct j k ) where L f `o` L g = L ( f `o` g ) R f `o` R g = R ( f `o` g ) _ `o` _ = error "GADT fail" instance ( Groupoid j , Groupoid k ) => Groupoid ( Coproduct j k ) where inv ( L f ) = L ( inv f ) inv ( R f ) = R ( inv f ) distributeDualCoproduct :: Dual ( Coproduct j k ) a b -> Coproduct ( Dual j ) ( Dual k ) a b distributeDualCoproduct ( Dual ( L l ) ) = L ( Dual l ) distributeDualCoproduct ( Dual ( R r ) ) = R ( Dual r ) factorDualCoproduct :: Coproduct ( Dual j ) ( Dual k ) a b -> Dual ( Coproduct j k ) a b factorDualCoproduct ( L ( Dual l ) ) = Dual ( L l ) factorDualCoproduct ( R ( Dual r ) ) = Dual ( R r )
2026-01-13T09:30:24
https://stdapi.ai/use_cases_openwebui/
OpenWebUI integration - stdapi.ai Skip to content stdapi.ai OpenWebUI integration Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration OpenWebUI integration Table of contents About OpenWebUI Why OpenWebUI + stdapi.ai? Prerequisites 🚀 Quick Start Configuration Step 1: Core Connection — Chat Completions Step 2: Voice Input — Speech to Text Step 3: Voice Output — Text to Speech Step 4: Visual Creativity — Image Generation Step 5: Intelligent Documents — RAG Embeddings 🔧 Deployment Methods Docker Compose (Recommended) Kubernetes / Helm Environment File (.env) 🎯 What You Can Do Now 💬 Intelligent Conversations 🎤 Voice Interactions 🎨 Creative Content 📚 Document Intelligence 🔧 Advanced Features 📊 Model Selection Guide 🔒 Security Best Practices 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents About OpenWebUI Why OpenWebUI + stdapi.ai? Prerequisites 🚀 Quick Start Configuration Step 1: Core Connection — Chat Completions Step 2: Voice Input — Speech to Text Step 3: Voice Output — Text to Speech Step 4: Visual Creativity — Image Generation Step 5: Intelligent Documents — RAG Embeddings 🔧 Deployment Methods Docker Compose (Recommended) Kubernetes / Helm Environment File (.env) 🎯 What You Can Do Now 💬 Intelligent Conversations 🎤 Voice Interactions 🎨 Creative Content 📚 Document Intelligence 🔧 Advanced Features 📊 Model Selection Guide 🔒 Security Best Practices 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Home Documentation Use cases OpenWebUI Integration ¶ Connect OpenWebUI to stdapi.ai as an OpenAI-compatible backend. Access Amazon Bedrock models through OpenWebUI's chat interface with no code changes required. About OpenWebUI ¶ 🔗 Links: Website | GitHub | Documentation | Discord OpenWebUI is a feature-rich, self-hosted web UI for AI models: 40,000+ GitHub stars - Popular open-source AI web interface Feature-complete - Matches ChatGPT's interface capabilities Multi-modal - Chat, voice input/output, image generation, and document RAG Extensible - Plugin system, custom functions, and community tools Privacy-focused - Self-hosted with no external dependencies Why OpenWebUI + stdapi.ai? ¶ Seamless Integration stdapi.ai acts as a drop-in replacement for OpenAI's API. Simply configure your OpenWebUI environment variables, and you're ready to use Amazon Bedrock models through the familiar ChatGPT-style interface. Key Benefits: Familiar interface - Continue using OpenWebUI as before Enterprise models - Access Anthropic Claude, Amazon Nova, and more Full feature set - Chat, voice, image generation, and RAG all work Privacy - Your data stays in your AWS environment Cost efficient - AWS pricing without OpenAI lock-in Multi-modal - Combine text, voice, images, and documents Work in Progress This integration guide is actively being developed and refined. While the configuration examples are based on documented APIs and best practices, they are pending practical validation. Complete end-to-end deployment examples will be added once testing is finalized. Prerequisites ¶ What You'll Need Before you begin, make sure you have: ✓ A running OpenWebUI instance (Docker, Kubernetes, or bare metal) ✓ Your stdapi.ai server URL (e.g., https://api.example.com ) ✓ An API key (if authentication is enabled on your stdapi.ai deployment) ✓ AWS access configured with the Bedrock models you want to use 🚀 Quick Start Configuration ¶ OpenWebUI is configured entirely through environment variables. Below is a step-by-step guide to enable each AI capability. Step 1: Core Connection — Chat Completions ¶ Start by establishing the base connection to stdapi.ai. This configuration is required and enables conversational AI features. Environment Variables # Core OpenAI API connection OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 OPENAI_API_KEY = YOUR_STDAPI_KEY # Default model for background tasks TASK_MODEL_EXTERNAL = amazon.nova-micro-v1:0 What This Enables 💬 Chat Interface: Access to all Amazon Bedrock chat models through OpenWebUI's interface 🎯 Model Selection: Choose from any available Bedrock model in the UI 🔧 Task Processing: Background operations like title generation and task summarization Available Models: All Amazon Bedrock chat models are automatically available in OpenWebUI once you configure the connection. This includes: Anthropic Claude — All Claude model variants (Sonnet, Haiku, Opus) Amazon Nova — All Nova family models (Pro, Lite, Micro) Meta Llama — Llama 3 models (if enabled in your AWS region) Mistral AI — Mistral and Mixtral models (if enabled in your AWS region) And more — Any other Bedrock models available in your configured AWS region Model Discovery OpenWebUI will automatically discover and list all available models from your stdapi.ai instance. Just configure the base URL and API key—no need to manually add models. Step 2: Voice Input — Speech to Text ¶ Enable hands-free interaction by allowing users to speak their queries instead of typing. Environment Variables # Enable speech-to-text AUDIO_STT_ENGINE = openai AUDIO_STT_OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 AUDIO_STT_MODEL = amazon.transcribe What This Enables 🎤 Voice Input: Click the microphone button to speak your messages 🌍 Multi-Language: Supports 35+ languages with automatic detection 📝 Accurate Transcription: Powered by Amazon Transcribe for high accuracy Use Cases: Accessibility: Make your AI interface accessible to users with typing difficulties Mobile Use: Perfect for on-the-go interactions on smartphones and tablets Multitasking: Interact with AI while performing other tasks Natural Interaction: Speak naturally instead of formulating written queries Step 3: Voice Output — Text to Speech ¶ Transform text responses into natural-sounding audio for a fully voice-enabled experience. Environment Variables # Enable text-to-speech AUDIO_TTS_ENGINE = openai AUDIO_TTS_OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 AUDIO_TTS_MODEL = amazon.polly-standard What This Enables 🔊 Audio Responses: Listen to AI responses instead of reading them 🎭 Multiple Voices: Choose from 60+ voices in 30+ languages ⚙️ Voice Customization: Select voices in OpenWebUI settings Voice Options: Voice Type Model ID Quality Use Case Standard amazon.polly-standard High-quality General use, cost-effective Neural amazon.polly-neural Ultra-realistic Premium experiences, podcasts Generative amazon.polly-generative Most natural Latest AI-generated voices Long-form amazon.polly-long-form Optimized for articles Long content, audiobooks Voice Configuration For Multi-Language Support: Set the voice to any OpenAI-compatible voice name (e.g., alloy , echo , nova ) in OpenWebUI's settings. stdapi.ai will automatically detect the language of the text and select an appropriate Amazon Polly voice. For Single-Language Use: If your content is always in the same language, you can specify a particular Amazon Polly voice for consistent results: English (US): Joanna, Matthew, Salli, Joey, Kendra, Kimberly English (UK): Emma, Brian, Amy Spanish: Lupe, Conchita, Miguel French: Celine, Mathieu German: Marlene, Hans And 50+ more voices in 30+ languages Configure specific voices in OpenWebUI's Settings → Audio → Text-to-Speech → Voice Use Cases: Accessibility: Support visually impaired users with audio output Learning: Improve comprehension through audio and text together Productivity: Listen to responses while working on other tasks Content Creation: Generate audio content directly from AI responses Step 4: Visual Creativity — Image Generation ¶ Bring creative ideas to life by generating images directly from text descriptions within your chat interface. Environment Variables # Enable image generation ENABLE_IMAGE_GENERATION = True IMAGE_GENERATION_ENGINE = openai IMAGES_OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 IMAGE_GENERATION_MODEL = amazon.nova-canvas-v1:0 What This Enables 🎨 In-Chat Image Creation: Generate images directly in conversations 🖼️ Multiple Formats: Support for various image sizes and styles ⚡ Fast Generation: Quick turnaround for creative iterations Available Image Models: While the example shows amazon.nova-canvas-v1:0 , you can use any image generation model available in Amazon Bedrock: Amazon Nova Canvas — amazon.nova-canvas-v1:0 (recommended, fast and high-quality) Stability AI — Stable Diffusion models (if enabled in your AWS region) Other providers — Any Bedrock image generation model Simply change the IMAGE_GENERATION_MODEL environment variable to your preferred model ID. How to Use: Type an image description in the chat Ask the AI to generate an image (e.g., "Create an image of...") The image appears directly in the conversation Download or refine with follow-up prompts Example Prompts: "Generate a photorealistic image of a modern office with plants and natural lighting" "Create a minimalist logo for a tech startup focused on sustainability" "Design a watercolor illustration of a sunset over mountains" "Make a futuristic concept art of a smart city with flying vehicles" Use Cases: Marketing Materials: Generate visuals for campaigns and presentations Prototyping: Quick mockups for design concepts Content Creation: Illustrations for blog posts and articles Education: Visual aids for teaching and learning Brainstorming: Rapid visualization of ideas Step 5: Intelligent Documents — RAG Embeddings ¶ Unlock the full power of Retrieval-Augmented Generation (RAG) to chat with your documents using semantic search. Environment Variables # Enable RAG with embeddings RAG_EMBEDDING_ENGINE = openai RAG_OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 RAG_EMBEDDING_MODEL = amazon.titan-embed-text-v2:0 What This Enables 📚 Document Chat: Upload PDFs, docs, and text files to chat with them 🔍 Semantic Search: Find information by meaning, not just keywords 🧠 Context-Aware Responses: AI answers questions using your document content 📊 Knowledge Base: Build a searchable knowledge base from your files Available Embedding Models: The example uses amazon.titan-embed-text-v2:0 , but you can choose from multiple embedding models available in Amazon Bedrock: Amazon Titan Embed Text v2 — amazon.titan-embed-text-v2:0 (recommended, optimized for RAG, 8192 dimensions) Amazon Titan Embed Text v1 — amazon.titan-embed-text-v1 (legacy, 1536 dimensions) Cohere Embed — Cohere embedding models (if enabled in your AWS region) Other providers — Any Bedrock embedding model Choose your embedding model based on: Dimension size — Higher dimensions (like Titan v2's 8192) capture more nuance but use more storage Performance — Some models are faster than others Language support — Ensure your chosen model supports your documents' languages Consistency Important Once you start building your knowledge base with a specific embedding model, stick with it. Changing models requires re-indexing all documents as embeddings from different models are not compatible. How It Works: Upload Documents: Add PDFs, Word docs, text files, or web content Automatic Indexing: OpenWebUI creates vector embeddings using Amazon Titan Semantic Search: Ask questions in natural language Contextual Answers: AI retrieves relevant passages and generates accurate responses What You Can Do: Research: Analyze multiple research papers and extract insights Documentation: Search technical documentation using natural language Legal: Review contracts and legal documents with AI assistance Business Intelligence: Query reports, presentations, and business documents Learning: Study textbooks and educational materials interactively Supported File Types: PDF documents Microsoft Word (.docx) Plain text (.txt) Markdown (.md) Web pages (via URL) RAG Best Practices Chunk Size: OpenWebUI automatically splits documents into optimal chunks Context Window: Larger models (Nova Pro, Claude Sonnet) handle more context Multiple Documents: Combine multiple sources for comprehensive answers Citation Tracking: OpenWebUI shows which documents were used for answers 🔧 Deployment Methods ¶ Choose the deployment method that best fits your infrastructure. Docker Compose (Recommended) ¶ The easiest way to deploy OpenWebUI with stdapi.ai using Docker. Complete docker-compose.yml version : '3.8' services : openwebui : image : ghcr.io/open-webui/open-webui:main container_name : openwebui ports : - "3000:8080" environment : # Core stdapi.ai connection - OPENAI_API_BASE_URL=https://YOUR_SERVER_URL/v1 - OPENAI_API_KEY=${STDAPI_KEY} - TASK_MODEL_EXTERNAL=amazon.nova-micro-v1:0 # Speech to Text - AUDIO_STT_ENGINE=openai - AUDIO_STT_OPENAI_API_BASE_URL=https://YOUR_SERVER_URL/v1 - AUDIO_STT_MODEL=amazon.transcribe # Text to Speech - AUDIO_TTS_ENGINE=openai - AUDIO_TTS_OPENAI_API_BASE_URL=https://YOUR_SERVER_URL/v1 - AUDIO_TTS_MODEL=amazon.polly-standard # Image Generation - ENABLE_IMAGE_GENERATION=True - IMAGE_GENERATION_ENGINE=openai - IMAGES_OPENAI_API_BASE_URL=https://YOUR_SERVER_URL/v1 - IMAGE_GENERATION_MODEL=amazon.nova-canvas-v1:0 # RAG Embeddings - RAG_EMBEDDING_ENGINE=openai - RAG_OPENAI_API_BASE_URL=https://YOUR_SERVER_URL/v1 - RAG_EMBEDDING_MODEL=amazon.titan-embed-text-v2:0 volumes : - openwebui_data:/app/backend/data restart : unless-stopped volumes : openwebui_data : Deploy: # Create .env file with your API key echo "STDAPI_KEY=your_api_key_here" > .env # Start OpenWebUI docker-compose up -d # View logs docker-compose logs -f Kubernetes / Helm ¶ Deploy OpenWebUI in Kubernetes with a ConfigMap for environment variables. Kubernetes ConfigMap apiVersion : v1 kind : ConfigMap metadata : name : openwebui-config data : OPENAI_API_BASE_URL : "https://YOUR_SERVER_URL/v1" TASK_MODEL_EXTERNAL : "amazon.nova-micro-v1:0" AUDIO_STT_ENGINE : "openai" AUDIO_STT_OPENAI_API_BASE_URL : "https://YOUR_SERVER_URL/v1" AUDIO_STT_MODEL : "amazon.transcribe" AUDIO_TTS_ENGINE : "openai" AUDIO_TTS_OPENAI_API_BASE_URL : "https://YOUR_SERVER_URL/v1" AUDIO_TTS_MODEL : "amazon.polly-standard" ENABLE_IMAGE_GENERATION : "True" IMAGE_GENERATION_ENGINE : "openai" IMAGES_OPENAI_API_BASE_URL : "https://YOUR_SERVER_URL/v1" IMAGE_GENERATION_MODEL : "amazon.nova-canvas-v1:0" RAG_EMBEDDING_ENGINE : "openai" RAG_OPENAI_API_BASE_URL : "https://YOUR_SERVER_URL/v1" RAG_EMBEDDING_MODEL : "amazon.titan-embed-text-v2:0" --- apiVersion : v1 kind : Secret metadata : name : openwebui-secret type : Opaque stringData : OPENAI_API_KEY : "your_stdapi_key_here" Environment File (.env) ¶ For bare metal or systemd deployments, use an environment file. .env Configuration # Core connection OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 OPENAI_API_KEY = your_stdapi_key_here TASK_MODEL_EXTERNAL = amazon.nova-micro-v1:0 # Speech to Text AUDIO_STT_ENGINE = openai AUDIO_STT_OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 AUDIO_STT_MODEL = amazon.transcribe # Text to Speech AUDIO_TTS_ENGINE = openai AUDIO_TTS_OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 AUDIO_TTS_MODEL = amazon.polly-standard # Image Generation ENABLE_IMAGE_GENERATION = True IMAGE_GENERATION_ENGINE = openai IMAGES_OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 IMAGE_GENERATION_MODEL = amazon.nova-canvas-v1:0 # RAG Embeddings RAG_EMBEDDING_ENGINE = openai RAG_OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 RAG_EMBEDDING_MODEL = amazon.titan-embed-text-v2:0 🎯 What You Can Do Now ¶ Once configured and running, your OpenWebUI + stdapi.ai integration unlocks powerful AI capabilities: 💬 Intelligent Conversations ¶ Multi-Turn Dialogues: Natural conversations with context awareness across messages Model Switching: Change models mid-conversation based on task complexity System Prompts: Customize AI behavior with custom system instructions Chat History: Full conversation history with search and export 🎤 Voice Interactions ¶ Voice-to-Voice: Speak your question and listen to the response—true hands-free AI Language Flexibility: Switch between languages seamlessly Mobile Friendly: Perfect experience on smartphones and tablets Meeting Mode: Use voice for brainstorming sessions and meetings 🎨 Creative Content ¶ Image Generation: Create visuals directly in your chat with natural language Iterative Design: Refine images with follow-up prompts Style Control: Specify artistic styles, lighting, composition, and mood Download & Share: Export generated images for use in your projects 📚 Document Intelligence ¶ Knowledge Retrieval: Upload documents and get instant answers from their content Multi-Document Analysis: Compare and synthesize information across multiple files Contextual Citations: See which documents informed each answer Continuous Learning: Build a growing knowledge base over time 🔧 Advanced Features ¶ Function Calling: Extend AI capabilities with custom functions and tools Code Execution: Run code directly in the chat interface Web Search: Enable real-time web search for current information Plugins: Extend functionality with OpenWebUI's plugin ecosystem 📊 Model Selection Guide ¶ Choose the right model for your use case to optimize performance and cost. These are suggestions only —many more models are available through Amazon Bedrock depending on your AWS region configuration. Available Models The models shown below are popular examples. All Amazon Bedrock models accessible through your stdapi.ai instance will automatically appear in OpenWebUI's model selector, including: Anthropic Claude family (all versions) Amazon Nova family (all tiers) Meta Llama models Mistral AI models Cohere models AI21 Labs models And any other Bedrock models enabled in your region Example Recommendations by Use Case: Scenario Example Model Why Quick Questions amazon.nova-micro-v1:0 Fast, cost-effective, great for simple queries General Chat amazon.nova-lite-v1:0 Balanced performance for everyday use Complex Analysis amazon.nova-pro-v1:0 Long context, advanced reasoning Code & Technical anthropic.claude-sonnet-4-5-20250929-v1:0 Superior coding, debugging, technical writing Creative Writing anthropic.claude-sonnet-4-5-20250929-v1:0 Nuanced language, storytelling, content creation Cost-Sensitive amazon.nova-micro-v1:0 Lowest cost per token Experiment & Compare OpenWebUI allows you to switch models mid-conversation. Start with a faster, cheaper model for brainstorming, then switch to a more powerful model for detailed implementation. Try different models to find what works best for your specific needs. 🔒 Security Best Practices ¶ Production Deployment Checklist ✅ Use HTTPS: Always use HTTPS for both OpenWebUI and stdapi.ai endpoints ✅ Secure API Keys: Store keys in environment variables or secrets management systems, never in code ✅ Enable Authentication: Configure OpenWebUI user authentication to control access ✅ Network Isolation: Deploy in a private network with proper firewall rules ✅ Regular Updates: Keep OpenWebUI and stdapi.ai updated with security patches ✅ Audit Logs: Enable logging for compliance and security monitoring ✅ Rate Limiting: Configure rate limits to prevent abuse ✅ Backup Data: Regular backups of conversation history and uploaded documents 🚀 Next Steps & Resources ¶ Getting Started ¶ Deploy: Use the Docker Compose example above to get running in minutes Configure Models: Add your preferred models in OpenWebUI's settings Test Features: Try chat, voice, images, and document upload Customize: Adjust system prompts and model parameters to your needs Scale: Monitor usage and scale your infrastructure as needed Learn More ¶ Additional Resources API Overview — Complete list of available models and capabilities Chat Completions API — Detailed chat API documentation Audio APIs — TTS and STT implementation details Configuration Guide — Advanced stdapi.ai configuration options OpenWebUI Documentation — Official OpenWebUI docs Community & Support ¶ Need Help? 💬 Join the OpenWebUI Discord community for tips and troubleshooting 📖 Review Amazon Bedrock documentation for model-specific details 🐛 Report issues on the GitHub repository 🔧 Consult AWS Support for infrastructure and model access questions ⚠️ Important Considerations ¶ Model Availability Regional Differences: Not all Amazon Bedrock models are available in every AWS region. Before configuring models, verify availability in your AWS region. Check availability: See the API Overview for a complete list of supported models by region. Performance Tips Model Response Times: Larger models (Claude Sonnet, Nova Pro) take longer to respond than smaller models (Nova Micro, Nova Lite). Choose appropriately for your use case. Streaming Responses: OpenWebUI supports streaming for a better user experience—responses appear word-by-word instead of all at once. Concurrent Users: Plan infrastructure capacity based on expected concurrent users and their model preferences. Cost Optimization Right-Size Models: Use Nova Micro for simple tasks to reduce costs Monitor Usage: Track token consumption through AWS CloudWatch Set Quotas: Configure user quotas in OpenWebUI to prevent runaway costs Cache Responses: Consider implementing caching for frequently asked questions Optimize Prompts: Shorter prompts consume fewer tokens while maintaining quality Back to top Previous Overview Next N8N integration JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/GHC-Conc.html#t:STM
GHC.Conc Source Contents Index base-4.6.0.1: Basic libraries Portability non-portable (GHC extensions) Stability internal Maintainer cvs-ghc@haskell.org Safe Haskell Unsafe GHC.Conc Contents Forking and suchlike Waiting TVars Miscellaneous Description Basic concurrency stuff. Synopsis data ThreadId = ThreadId ThreadId# forkIO :: IO () -> IO ThreadId forkIOUnmasked :: IO () -> IO ThreadId forkIOWithUnmask :: (( forall a. IO a -> IO a) -> IO ()) -> IO ThreadId forkOn :: Int -> IO () -> IO ThreadId forkOnIO :: Int -> IO () -> IO ThreadId forkOnIOUnmasked :: Int -> IO () -> IO ThreadId forkOnWithUnmask :: Int -> (( forall a. IO a -> IO a) -> IO ()) -> IO ThreadId numCapabilities :: Int getNumCapabilities :: IO Int setNumCapabilities :: Int -> IO () getNumProcessors :: IO Int numSparks :: IO Int childHandler :: SomeException -> IO () myThreadId :: IO ThreadId killThread :: ThreadId -> IO () throwTo :: Exception e => ThreadId -> e -> IO () par :: a -> b -> b pseq :: a -> b -> b runSparks :: IO () yield :: IO () labelThread :: ThreadId -> String -> IO () mkWeakThreadId :: ThreadId -> IO ( Weak ThreadId ) data ThreadStatus = ThreadRunning | ThreadFinished | ThreadBlocked BlockReason | ThreadDied data BlockReason = BlockedOnMVar | BlockedOnBlackHole | BlockedOnException | BlockedOnSTM | BlockedOnForeignCall | BlockedOnOther threadStatus :: ThreadId -> IO ThreadStatus threadCapability :: ThreadId -> IO ( Int , Bool ) threadDelay :: Int -> IO () registerDelay :: Int -> IO ( TVar Bool ) threadWaitRead :: Fd -> IO () threadWaitWrite :: Fd -> IO () closeFdWith :: ( Fd -> IO ()) -> Fd -> IO () newtype STM a = STM ( State# RealWorld -> (# State# RealWorld , a#)) atomically :: STM a -> IO a retry :: STM a orElse :: STM a -> STM a -> STM a throwSTM :: Exception e => e -> STM a catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a alwaysSucceeds :: STM a -> STM () always :: STM Bool -> STM () data TVar a = TVar ( TVar# RealWorld a) newTVar :: a -> STM ( TVar a) newTVarIO :: a -> IO ( TVar a) readTVar :: TVar a -> STM a readTVarIO :: TVar a -> IO a writeTVar :: TVar a -> a -> STM () unsafeIOToSTM :: IO a -> STM a withMVar :: MVar a -> (a -> IO b) -> IO b type Signal = CInt type HandlerFun = ForeignPtr Word8 -> IO () setHandler :: Signal -> Maybe ( HandlerFun , Dynamic ) -> IO ( Maybe ( HandlerFun , Dynamic )) runHandlers :: ForeignPtr Word8 -> Signal -> IO () ensureIOManagerIsRunning :: IO () setUncaughtExceptionHandler :: ( SomeException -> IO ()) -> IO () getUncaughtExceptionHandler :: IO ( SomeException -> IO ()) reportError :: SomeException -> IO () reportStackOverflow :: IO () Documentation data ThreadId Source A ThreadId is an abstract type representing a handle to a thread. ThreadId is an instance of Eq , Ord and Show , where the Ord instance implements an arbitrary total ordering over ThreadId s. The Show instance lets you convert an arbitrary-valued ThreadId to string form; showing a ThreadId value is occasionally useful when debugging or diagnosing the behaviour of a concurrent program. Note : in GHC, if you have a ThreadId , you essentially have a pointer to the thread itself. This means the thread itself can't be garbage collected until you drop the ThreadId . This misfeature will hopefully be corrected at a later date. Note : Hugs does not provide any operations on other threads; it defines ThreadId as a synonym for (). Constructors ThreadId ThreadId#   Instances Eq ThreadId   Ord ThreadId   Show ThreadId   Typeable ThreadId   Forking and suchlike forkIO :: IO () -> IO ThreadId Source Sparks off a new thread to run the IO computation passed as the first argument, and returns the ThreadId of the newly created thread. The new thread will be a lightweight thread; if you want to use a foreign library that uses thread-local storage, use forkOS instead. GHC note: the new thread inherits the masked state of the parent (see mask ). The newly created thread has an exception handler that discards the exceptions BlockedIndefinitelyOnMVar , BlockedIndefinitelyOnSTM , and ThreadKilled , and passes all other exceptions to the uncaught exception handler. forkIOUnmasked :: IO () -> IO ThreadId Source Deprecated: use forkIOWithUnmask instead This function is deprecated; use forkIOWithUnmask instead forkIOWithUnmask :: (( forall a. IO a -> IO a) -> IO ()) -> IO ThreadId Source Like forkIO , but the child thread is passed a function that can be used to unmask asynchronous exceptions. This function is typically used in the following way ... mask_ $ forkIOWithUnmask $ \unmask -> catch (unmask ...) handler so that the exception handler in the child thread is established with asynchronous exceptions masked, meanwhile the main body of the child thread is executed in the unmasked state. Note that the unmask function passed to the child thread should only be used in that thread; the behaviour is undefined if it is invoked in a different thread. forkOn :: Int -> IO () -> IO ThreadId Source Like forkIO , but lets you specify on which processor the thread should run. Unlike a forkIO thread, a thread created by forkOn will stay on the same processor for its entire lifetime ( forkIO threads can migrate between processors according to the scheduling policy). forkOn is useful for overriding the scheduling policy when you know in advance how best to distribute the threads. The Int argument specifies a capability number (see getNumCapabilities ). Typically capabilities correspond to physical processors, but the exact behaviour is implementation-dependent. The value passed to forkOn is interpreted modulo the total number of capabilities as returned by getNumCapabilities . GHC note: the number of capabilities is specified by the +RTS -N option when the program is started. Capabilities can be fixed to actual processor cores with +RTS -qa if the underlying operating system supports that, although in practice this is usually unnecessary (and may actually degrade perforamnce in some cases - experimentation is recommended). forkOnIO :: Int -> IO () -> IO ThreadId Source Deprecated: renamed to forkOn This function is deprecated; use forkOn instead forkOnIOUnmasked :: Int -> IO () -> IO ThreadId Source Deprecated: use forkOnWithUnmask instead This function is deprecated; use forkOnWIthUnmask instead forkOnWithUnmask :: Int -> (( forall a. IO a -> IO a) -> IO ()) -> IO ThreadId Source Like forkIOWithUnmask , but the child thread is pinned to the given CPU, as with forkOn . numCapabilities :: Int Source the value passed to the +RTS -N flag. This is the number of Haskell threads that can run truly simultaneously at any given time, and is typically set to the number of physical processor cores on the machine. Strictly speaking it is better to use getNumCapabilities , because the number of capabilities might vary at runtime. getNumCapabilities :: IO Int Source Returns the number of Haskell threads that can run truly simultaneously (on separate physical processors) at any given time. To change this value, use setNumCapabilities . setNumCapabilities :: Int -> IO () Source Set the number of Haskell threads that can run truly simultaneously (on separate physical processors) at any given time. The number passed to forkOn is interpreted modulo this value. The initial value is given by the +RTS -N runtime flag. This is also the number of threads that will participate in parallel garbage collection. It is strongly recommended that the number of capabilities is not set larger than the number of physical processor cores, and it may often be beneficial to leave one or more cores free to avoid contention with other processes in the machine. getNumProcessors :: IO Int Source numSparks :: IO Int Source Returns the number of sparks currently in the local spark pool childHandler :: SomeException -> IO () Source myThreadId :: IO ThreadId Source Returns the ThreadId of the calling thread (GHC only). killThread :: ThreadId -> IO () Source killThread raises the ThreadKilled exception in the given thread (GHC only). killThread tid = throwTo tid ThreadKilled throwTo :: Exception e => ThreadId -> e -> IO () Source throwTo raises an arbitrary exception in the target thread (GHC only). throwTo does not return until the exception has been raised in the target thread. The calling thread can thus be certain that the target thread has received the exception. This is a useful property to know when dealing with race conditions: eg. if there are two threads that can kill each other, it is guaranteed that only one of the threads will get to kill the other. Whatever work the target thread was doing when the exception was raised is not lost: the computation is suspended until required by another thread. If the target thread is currently making a foreign call, then the exception will not be raised (and hence throwTo will not return) until the call has completed. This is the case regardless of whether the call is inside a mask or not. However, in GHC a foreign call can be annotated as interruptible , in which case a throwTo will cause the RTS to attempt to cause the call to return; see the GHC documentation for more details. Important note: the behaviour of throwTo differs from that described in the paper "Asynchronous exceptions in Haskell" ( http://research.microsoft.com/~simonpj/Papers/asynch-exns.htm ). In the paper, throwTo is non-blocking; but the library implementation adopts a more synchronous design in which throwTo does not return until the exception is received by the target thread. The trade-off is discussed in Section 9 of the paper. Like any blocking operation, throwTo is therefore interruptible (see Section 5.3 of the paper). Unlike other interruptible operations, however, throwTo is always interruptible, even if it does not actually block. There is no guarantee that the exception will be delivered promptly, although the runtime will endeavour to ensure that arbitrary delays don't occur. In GHC, an exception can only be raised when a thread reaches a safe point , where a safe point is where memory allocation occurs. Some loops do not perform any memory allocation inside the loop and therefore cannot be interrupted by a throwTo . If the target of throwTo is the calling thread, then the behaviour is the same as throwIO , except that the exception is thrown as an asynchronous exception. This means that if there is an enclosing pure computation, which would be the case if the current IO operation is inside unsafePerformIO or unsafeInterleaveIO , that computation is not permanently replaced by the exception, but is suspended as if it had received an asynchronous exception. Note that if throwTo is called with the current thread as the target, the exception will be thrown even if the thread is currently inside mask or uninterruptibleMask . par :: a -> b -> b Source pseq :: a -> b -> b Source runSparks :: IO () Source Internal function used by the RTS to run sparks. yield :: IO () Source The yield action allows (forces, in a co-operative multitasking implementation) a context-switch to any other currently runnable threads (if any), and is occasionally useful when implementing concurrency abstractions. labelThread :: ThreadId -> String -> IO () Source labelThread stores a string as identifier for this thread if you built a RTS with debugging support. This identifier will be used in the debugging output to make distinction of different threads easier (otherwise you only have the thread state object's address in the heap). Other applications like the graphical Concurrent Haskell Debugger ( http://www.informatik.uni-kiel.de/~fhu/chd/ ) may choose to overload labelThread for their purposes as well. mkWeakThreadId :: ThreadId -> IO ( Weak ThreadId ) Source make a weak pointer to a ThreadId . It can be important to do this if you want to hold a reference to a ThreadId while still allowing the thread to receive the BlockedIndefinitely family of exceptions (e.g. BlockedIndefinitelyOnMVar ). Holding a normal ThreadId reference will prevent the delivery of BlockedIndefinitely exceptions because the reference could be used as the target of throwTo at any time, which would unblock the thread. Holding a Weak ThreadId , on the other hand, will not prevent the thread from receiving BlockedIndefinitely exceptions. It is still possible to throw an exception to a Weak ThreadId , but the caller must use deRefWeak first to determine whether the thread still exists. data ThreadStatus Source The current status of a thread Constructors ThreadRunning the thread is currently runnable or running ThreadFinished the thread has finished ThreadBlocked BlockReason the thread is blocked on some resource ThreadDied the thread received an uncaught exception Instances Eq ThreadStatus   Ord ThreadStatus   Show ThreadStatus   data BlockReason Source Constructors BlockedOnMVar blocked on on MVar BlockedOnBlackHole blocked on a computation in progress by another thread BlockedOnException blocked in throwTo BlockedOnSTM blocked in retry in an STM transaction BlockedOnForeignCall currently in a foreign call BlockedOnOther blocked on some other resource. Without -threaded , I/O and threadDelay show up as BlockedOnOther , with -threaded they show up as BlockedOnMVar . Instances Eq BlockReason   Ord BlockReason   Show BlockReason   threadStatus :: ThreadId -> IO ThreadStatus Source threadCapability :: ThreadId -> IO ( Int , Bool ) Source returns the number of the capability on which the thread is currently running, and a boolean indicating whether the thread is locked to that capability or not. A thread is locked to a capability if it was created with forkOn . Waiting threadDelay :: Int -> IO () Source Suspends the current thread for a given number of microseconds (GHC only). There is no guarantee that the thread will be rescheduled promptly when the delay has expired, but the thread will never continue to run earlier than specified. registerDelay :: Int -> IO ( TVar Bool ) Source Set the value of returned TVar to True after a given number of microseconds. The caveats associated with threadDelay also apply. threadWaitRead :: Fd -> IO () Source Block the current thread until data is available to read on the given file descriptor (GHC only). This will throw an IOError if the file descriptor was closed while this thread was blocked. To safely close a file descriptor that has been used with threadWaitRead , use closeFdWith . threadWaitWrite :: Fd -> IO () Source Block the current thread until data can be written to the given file descriptor (GHC only). This will throw an IOError if the file descriptor was closed while this thread was blocked. To safely close a file descriptor that has been used with threadWaitWrite , use closeFdWith . closeFdWith Source Arguments :: ( Fd -> IO ()) Low-level action that performs the real close. -> Fd File descriptor to close. -> IO ()   Close a file descriptor in a concurrency-safe way (GHC only). If you are using threadWaitRead or threadWaitWrite to perform blocking I/O, you must use this function to close file descriptors, or blocked threads may not be woken. Any threads that are blocked on the file descriptor via threadWaitRead or threadWaitWrite will be unblocked by having IO exceptions thrown. TVars newtype STM a Source A monad supporting atomic memory transactions. Constructors STM ( State# RealWorld -> (# State# RealWorld , a#))   Instances Monad STM   Functor STM   Typeable1 STM   MonadPlus STM   Applicative STM   Alternative STM   atomically :: STM a -> IO a Source Perform a series of STM actions atomically. You cannot use atomically inside an unsafePerformIO or unsafeInterleaveIO . Any attempt to do so will result in a runtime error. (Reason: allowing this would effectively allow a transaction inside a transaction, depending on exactly when the thunk is evaluated.) However, see newTVarIO , which can be called inside unsafePerformIO , and which allows top-level TVars to be allocated. retry :: STM a Source Retry execution of the current memory transaction because it has seen values in TVars which mean that it should not continue (e.g. the TVars represent a shared buffer that is now empty). The implementation may block the thread until one of the TVars that it has read from has been udpated. (GHC only) orElse :: STM a -> STM a -> STM a Source Compose two alternative STM actions (GHC only). If the first action completes without retrying then it forms the result of the orElse. Otherwise, if the first action retries, then the second action is tried in its place. If both actions retry then the orElse as a whole retries. throwSTM :: Exception e => e -> STM a Source A variant of throw that can only be used within the STM monad. Throwing an exception in STM aborts the transaction and propagates the exception. Although throwSTM has a type that is an instance of the type of throw , the two functions are subtly different: throw e `seq` x ===> throw e throwSTM e `seq` x ===> x The first example will cause the exception e to be raised, whereas the second one won't. In fact, throwSTM will only cause an exception to be raised when it is used within the STM monad. The throwSTM variant should be used in preference to throw to raise an exception within the STM monad because it guarantees ordering with respect to other STM operations, whereas throw does not. catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a Source Exception handling within STM actions. alwaysSucceeds :: STM a -> STM () Source alwaysSucceeds adds a new invariant that must be true when passed to alwaysSucceeds, at the end of the current transaction, and at the end of every subsequent transaction. If it fails at any of those points then the transaction violating it is aborted and the exception raised by the invariant is propagated. always :: STM Bool -> STM () Source always is a variant of alwaysSucceeds in which the invariant is expressed as an STM Bool action that must return True. Returning False or raising an exception are both treated as invariant failures. data TVar a Source Shared memory locations that support atomic memory transactions. Constructors TVar ( TVar# RealWorld a)   Instances Typeable1 TVar   Eq ( TVar a)   newTVar :: a -> STM ( TVar a) Source Create a new TVar holding a value supplied newTVarIO :: a -> IO ( TVar a) Source IO version of newTVar . This is useful for creating top-level TVar s using unsafePerformIO , because using atomically inside unsafePerformIO isn't possible. readTVar :: TVar a -> STM a Source Return the current value stored in a TVar readTVarIO :: TVar a -> IO a Source Return the current value stored in a TVar. This is equivalent to readTVarIO = atomically . readTVar but works much faster, because it doesn't perform a complete transaction, it just reads the current value of the TVar . writeTVar :: TVar a -> a -> STM () Source Write the supplied value into a TVar unsafeIOToSTM :: IO a -> STM a Source Unsafely performs IO in the STM monad. Beware: this is a highly dangerous thing to do. The STM implementation will often run transactions multiple times, so you need to be prepared for this if your IO has any side effects. The STM implementation will abort transactions that are known to be invalid and need to be restarted. This may happen in the middle of unsafeIOToSTM , so make sure you don't acquire any resources that need releasing (exception handlers are ignored when aborting the transaction). That includes doing any IO using Handles, for example. Getting this wrong will probably lead to random deadlocks. The transaction may have seen an inconsistent view of memory when the IO runs. Invariants that you expect to be true throughout your program may not be true inside a transaction, due to the way transactions are implemented. Normally this wouldn't be visible to the programmer, but using unsafeIOToSTM can expose it. Miscellaneous withMVar :: MVar a -> (a -> IO b) -> IO b Source type Signal = CInt Source type HandlerFun = ForeignPtr Word8 -> IO () Source setHandler :: Signal -> Maybe ( HandlerFun , Dynamic ) -> IO ( Maybe ( HandlerFun , Dynamic )) Source runHandlers :: ForeignPtr Word8 -> Signal -> IO () Source ensureIOManagerIsRunning :: IO () Source setUncaughtExceptionHandler :: ( SomeException -> IO ()) -> IO () Source getUncaughtExceptionHandler :: IO ( SomeException -> IO ()) Source reportError :: SomeException -> IO () Source reportStackOverflow :: IO () Source Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://sequel.jeremyevans.net/rdoc-plugins/classes/Sequel/Plugins/AutoValidations.html
Sequel::Plugins::AutoValidations module Sequel::Plugins::AutoValidations lib/sequel/plugins/auto_validations.rb The auto_validations plugin automatically sets up the following types of validations for your model columns: type validations for all columns not_null validations on NOT NULL columns (optionally, presence validations) unique validations on columns or sets of columns with unique indexes max length validations on string columns no null byte validations on string columns minimum and maximum values on columns To determine the columns to use for the type/not_null/max_length/no_null_byte/max_value/min_value validations, the plugin looks at the database schema for the model’s table. To determine the unique validations, Sequel looks at the indexes on the table. In order for this plugin to be fully functional, the underlying database adapter needs to support both schema and index parsing. Additionally, unique validations are only added for models that select from a simple table, they are not added for models that select from a subquery. This plugin uses the validation_helpers plugin underneath to implement the validations. It does not allow for any per-column validation message customization, but you can alter the messages for the given type of validation on a per-model basis (see the validation_helpers documentation). You can skip certain types of validations from being automatically added via: Model . skip_auto_validations ( :not_null ) If you want to skip all auto validations (only useful if loading the plugin in a superclass): Model . skip_auto_validations ( :all ) It is possible to skip auto validations on a per-model-instance basis via: instance . skip_auto_validations ( :unique , :not_null ) do puts instance . valid? end By default, the plugin uses a not_null validation for NOT NULL columns, but that can be changed to a presence validation using an option: Model . plugin :auto_validations , not_null: :presence This is useful if you want to enforce that NOT NULL string columns do not allow empty values. You can also supply hashes to pass options through to the underlying validators: Model . plugin :auto_validations , unique_opts: { only_if_modified: true } This works for unique_opts, max_length_opts, schema_types_opts, max_value_opts, min_value_opts, no_null_byte_opts, explicit_not_null_opts, and not_null_opts. If you only want auto_validations to add validations to columns that do not already have an error associated with them, you can use the skip_invalid option: Model . plugin :auto_validations , skip_invalid: true Usage: # Make all model subclass use auto validations (called before loading subclasses) Sequel :: Model . plugin :auto_validations # Make the Album class use auto validations Album . plugin :auto_validations Methods Public Class apply configure Classes and Modules Sequel::Plugins::AutoValidations::ClassMethods Sequel::Plugins::AutoValidations::InstanceMethods Constants AUTO_VALIDATE_OPTIONS = { :no_null_byte=>NO_NULL_BYTE_OPTIONS, :not_null=>NOT_NULL_OPTIONS, :explicit_not_null=>EXPLICIT_NOT_NULL_OPTIONS, :max_length=>MAX_LENGTH_OPTIONS, :max_value=>MAX_VALUE_OPTIONS, :min_value=>MIN_VALUE_OPTIONS, :schema_types=>SCHEMA_TYPES_OPTIONS, :unique=>UNIQUE_OPTIONS }.freeze   EMPTY_ARRAY = [].freeze   EXPLICIT_NOT_NULL_OPTIONS = {:from=>:values, :allow_missing=>true}.freeze   MAX_LENGTH_OPTIONS = {:from=>:values, :allow_nil=>true}.freeze   MAX_VALUE_OPTIONS = {:from=>:values, :allow_nil=>true, :skip_invalid=>true}.freeze   MIN_VALUE_OPTIONS = MAX_VALUE_OPTIONS   NOT_NULL_OPTIONS = {:from=>:values}.freeze   NO_NULL_BYTE_OPTIONS = MAX_LENGTH_OPTIONS   SCHEMA_TYPES_OPTIONS = NOT_NULL_OPTIONS   UNIQUE_OPTIONS = NOT_NULL_OPTIONS   Public Class methods apply (model, opts=OPTS) [show source] # File lib/sequel/plugins/auto_validations.rb 92 def self . apply ( model , opts = OPTS ) 93 model . instance_exec do 94 plugin :validation_helpers 95 @auto_validate_presence = false 96 @auto_validate_no_null_byte_columns = [] 97 @auto_validate_not_null_columns = [] 98 @auto_validate_explicit_not_null_columns = [] 99 @auto_validate_max_length_columns = [] 100 @auto_validate_max_value_columns = [] 101 @auto_validate_min_value_columns = [] 102 @auto_validate_unique_columns = [] 103 @auto_validate_types = true 104 @auto_validate_options = AUTO_VALIDATE_OPTIONS 105 end 106 end configure (model, opts=OPTS) Setup auto validations for the model if it has a dataset. [show source] # File lib/sequel/plugins/auto_validations.rb 109 def self . configure ( model , opts = OPTS ) 110 model . instance_exec do 111 setup_auto_validations if @dataset 112 if opts [ :not_null ] == :presence 113 @auto_validate_presence = true 114 end 115 116 h = @auto_validate_options . dup 117 [ :not_null , :explicit_not_null , :max_length , :max_value , :min_value , :no_null_byte , :schema_types , :unique ]. each do | type | 118 if type_opts = opts [ :"#{type}_opts" ] 119 h [ type ] = h [ type ]. merge ( type_opts ). freeze 120 end 121 end 122 123 if opts [ :skip_invalid ] 124 [ :not_null , :explicit_not_null , :no_null_byte , :max_length , :schema_types ]. each do | type | 125 h [ type ] = h [ type ]. merge ( :skip_invalid => true ). freeze 126 end 127 end 128 129 @auto_validate_options = h . freeze 130 end 131 end Hanna RDoc template
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Semifunctor.html
src/Data/Semifunctor.hs {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 #ifdef MIN_VERSION_comonad #if MIN_VERSION_comonad(3,0,3) {-# LANGUAGE Safe #-} #else {-# LANGUAGE Trustworthy #-} #endif #else {-# LANGUAGE Trustworthy #-} #endif #endif module Data . Semifunctor ( Semifunctor ( .. ) , Bi ( .. ) , ( # ) , semibimap , semifirst , semisecond , first , second , WrappedFunctor ( .. ) , WrappedTraversable1 ( .. ) , module Control . Category , module Data . Semigroupoid , module Data . Semigroupoid . Ob , module Data . Semigroupoid . Product ) where import Control . Arrow hiding ( first , second , left , right ) import Control . Category import Control . Monad ( liftM ) import Data . Functor . Bind import Data . Traversable import Data . Semigroup . Traversable import Data . Semigroupoid import Data . Semigroupoid . Dual import Data . Semigroupoid . Ob import Data . Semigroupoid . Product import Prelude hiding ( ( . ) , id , mapM ) #ifdef MIN_VERSION_comonad import Control . Comonad import Data . Functor . Extend #ifdef MIN_VERSION_distributive import Data . Distributive #endif #endif -- | Semifunctors map objects to objects, and arrows to arrows preserving connectivity -- as normal functors, but do not purport to preserve identity arrows. We apply them -- to semigroupoids, because those don't even claim to offer identity arrows! class ( Semigroupoid c , Semigroupoid d ) => Semifunctor f c d | f c -> d , f d -> c where semimap :: c a b -> d ( f a ) ( f b ) data WrappedFunctor f a = WrapFunctor { unwrapFunctor :: f a } instance Functor f => Semifunctor ( WrappedFunctor f ) ( -> ) ( -> ) where semimap f = WrapFunctor . fmap f . unwrapFunctor instance ( Traversable f , Bind m , Monad m ) => Semifunctor ( WrappedFunctor f ) ( Kleisli m ) ( Kleisli m ) where semimap ( Kleisli f ) = Kleisli $ liftM WrapFunctor . mapM f . unwrapFunctor #if defined(MIN_VERSION_distributive) && defined(MIN_VERSION_comonad) instance ( Distributive f , Extend w ) => Semifunctor ( WrappedFunctor f ) ( Cokleisli w ) ( Cokleisli w ) where semimap ( Cokleisli w ) = Cokleisli $ WrapFunctor . cotraverse w . fmap unwrapFunctor #endif data WrappedTraversable1 f a = WrapTraversable1 { unwrapTraversable1 :: f a } instance ( Traversable1 f , Bind m ) => Semifunctor ( WrappedTraversable1 f ) ( Kleisli m ) ( Kleisli m ) where semimap ( Kleisli f ) = Kleisli $ fmap WrapTraversable1 . traverse1 f . unwrapTraversable1 -- | Used to map a more traditional bifunctor into a semifunctor data Bi p a where Bi :: p a b -> Bi p ( a , b ) instance Semifunctor f c d => Semifunctor f ( Dual c ) ( Dual d ) where semimap ( Dual f ) = Dual ( semimap f ) ( # ) :: a -> b -> Bi (,) ( a , b ) a # b = Bi ( a , b ) #ifdef MIN_VERSION_comonad fstP :: Bi (,) ( a , b ) -> a fstP ( Bi ( a , _ ) ) = a sndP :: Bi (,) ( a , b ) -> b sndP ( Bi ( _ , b ) ) = b #endif left :: a -> Bi Either ( a , b ) left = Bi . Left right :: b -> Bi Either ( a , b ) right = Bi . Right instance Semifunctor ( Bi (,) ) ( Product ( -> ) ( -> ) ) ( -> ) where semimap ( Pair l r ) ( Bi ( a , b ) ) = l a # r b instance Semifunctor ( Bi Either ) ( Product ( -> ) ( -> ) ) ( -> ) where semimap ( Pair l _ ) ( Bi ( Left a ) ) = Bi ( Left ( l a ) ) semimap ( Pair _ r ) ( Bi ( Right b ) ) = Bi ( Right ( r b ) ) instance Bind m => Semifunctor ( Bi (,) ) ( Product ( Kleisli m ) ( Kleisli m ) ) ( Kleisli m ) where semimap ( Pair l r ) = Kleisli ( \ ( Bi ( a , b ) ) -> ( # ) <$> runKleisli l a <.> runKleisli r b ) instance Bind m => Semifunctor ( Bi Either ) ( Product ( Kleisli m ) ( Kleisli m ) ) ( Kleisli m ) where semimap ( Pair ( Kleisli l0 ) ( Kleisli r0 ) ) = Kleisli ( lr l0 r0 ) where lr :: Functor m => ( a -> m c ) -> ( b -> m d ) -> Bi Either ( a , b ) -> m ( Bi Either ( c , d ) ) lr l _ ( Bi ( Left a ) ) = left <$> l a lr _ r ( Bi ( Right b ) ) = right <$> r b #ifdef MIN_VERSION_comonad instance Extend w => Semifunctor ( Bi (,) ) ( Product ( Cokleisli w ) ( Cokleisli w ) ) ( Cokleisli w ) where semimap ( Pair l r ) = Cokleisli $ \ p -> runCokleisli l ( fstP <$> p ) # runCokleisli r ( sndP <$> p ) -- instance Extend w => Semifunctor (Bi Either)) (Product (Cokleisli w) (Cokleisli w)) (Cokleisli w) where #endif semibimap :: Semifunctor p ( Product l r ) cod => l a b -> r c d -> cod ( p ( a , c ) ) ( p ( b , d ) ) semibimap f g = semimap ( Pair f g ) semifirst :: ( Semifunctor p ( Product l r ) cod , Ob r c ) => l a b -> cod ( p ( a , c ) ) ( p ( b , c ) ) semifirst f = semimap ( Pair f semiid ) semisecond :: ( Semifunctor p ( Product l r ) cod , Ob l a ) => r b c -> cod ( p ( a , b ) ) ( p ( a , c ) ) semisecond f = semimap ( Pair semiid f ) first :: ( Semifunctor p ( Product l r ) cod , Category r ) => l a b -> cod ( p ( a , c ) ) ( p ( b , c ) ) first f = semimap ( Pair f id ) second :: ( Semifunctor p ( Product l r ) cod , Category l ) => r b c -> cod ( p ( a , b ) ) ( p ( a , c ) ) second f = semimap ( Pair id f )
2026-01-13T09:30:24
https://sequel.jeremyevans.net
Sequel: The Database Toolkit for Ruby Documentation Plugins Development Links Sequel: The Database Toolkit for Ruby Thread safety, connection pooling and a concise DSL for constructing SQL queries and table schemas. Comprehensive ORM layer for mapping records to Ruby objects and handling associated records. Advanced database features such as prepared statements, bound variables, stored procedures, savepoints, two-phase commit, transaction isolation, primary/replica configurations, and database sharding. With adapters for ADO, Amalgalite, IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle, PostgreSQL, SQLAnywhere, SQLite3, TinyTDS, and Trilogy. require " sequel " # connect to an in-memory database DB = Sequel . sqlite # create an items table DB . create_table :items do primary_key :id String :name , unique: true , null: false Float :price , null: false end # create a dataset from the items table items = DB [ :items ] # populate the table items . insert ( name: ' abc ', price: rand * 100 ) items . insert ( name: ' def ', price: rand * 100 ) items . insert ( name: ' ghi ', price: rand * 100 ) # print out the number of records puts " Item count: #{items.count} " # print out the average price puts " The average price is: #{items.avg(:price)} " Documentation General Overview Databases Datasets Models Misc RDoc Release Notes Plugins Model Plugins Sequel Extensions Development Reporting Bugs Contribute Source Code License Links Articles Presentations Logos & Badges Using Sequel RubyGems GitHub
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroups-0.15.2/docs/Data-Semigroup.html#t:Semigroup
Data.Semigroup Source Contents Index semigroups-0.15.2: Anything that associates Portability portable Stability provisional Maintainer Edward Kmett <ekmett@gmail.com> Safe Haskell Trustworthy Data.Semigroup Contents Semigroups Re-exported monoids from Data.Monoid A better monoid for Maybe Difference lists of a semigroup Description In mathematics, a semigroup is an algebraic structure consisting of a set together with an associative binary operation. A semigroup generalizes a monoid in that there might not exist an identity element. It also (originally) generalized a group (a monoid with all inverses) to a type where every element did not have to have an inverse, thus the name semigroup. The use of (<>) in this module conflicts with an operator with the same name that is being exported by Data.Monoid. However, this package re-exports (most of) the contents of Data.Monoid, so to use semigroups and monoids in the same package just import Data.Semigroup Synopsis class Semigroup a where (<>) :: a -> a -> a sconcat :: NonEmpty a -> a times1p :: Whole n => n -> a -> a newtype Min a = Min { getMin :: a } newtype Max a = Max { getMax :: a } newtype First a = First { getFirst :: a } newtype Last a = Last { getLast :: a } newtype WrappedMonoid m = WrapMonoid { unwrapMonoid :: m } timesN :: ( Whole n, Monoid a) => n -> a -> a class Monoid a where mempty :: a mappend :: a -> a -> a mconcat :: [a] -> a newtype Dual a = Dual { getDual :: a } newtype Endo a = Endo { appEndo :: a -> a } newtype All = All { getAll :: Bool } newtype Any = Any { getAny :: Bool } newtype Sum a = Sum { getSum :: a } newtype Product a = Product { getProduct :: a } newtype Option a = Option { getOption :: Maybe a } option :: b -> (a -> b) -> Option a -> b diff :: Semigroup m => m -> Endo m cycle1 :: Semigroup m => m -> m Documentation class Semigroup a where Source Methods (<>) :: a -> a -> a Source An associative operation. (a <> b) <> c = a <> (b <> c) If a is also a Monoid we further require ( <> ) = mappend sconcat :: NonEmpty a -> a Source Reduce a non-empty list with <> The default definition should be sufficient, but this can be overridden for efficiency. times1p :: Whole n => n -> a -> a Source Repeat a value (n + 1) times. times1p n a = a <> a <> ... <> a -- using <> n times The default definition uses peasant multiplication, exploiting associativity to only require O(log n) uses of <> . See also timesN . Instances Semigroup Ordering   Semigroup ()   Semigroup All   Semigroup Any   Semigroup ByteString   Semigroup ByteString   Semigroup IntSet   Semigroup Text   Semigroup Text   Semigroup [a]   Semigroup a => Semigroup ( Dual a)   Semigroup ( Endo a)   Num a => Semigroup ( Sum a)   Num a => Semigroup ( Product a)   Semigroup ( First a)   Semigroup ( Last a)   Semigroup a => Semigroup ( Maybe a)   Semigroup ( Seq a)   Semigroup ( IntMap v)   Ord a => Semigroup ( Set a)   ( Hashable a, Eq a) => Semigroup ( HashSet a)   Semigroup ( NonEmpty a)   Semigroup a => Semigroup ( Option a)   Monoid m => Semigroup ( WrappedMonoid m)   Semigroup ( Last a)   Semigroup ( First a)   Ord a => Semigroup ( Max a)   Ord a => Semigroup ( Min a)   Semigroup b => Semigroup (a -> b)   Semigroup ( Either a b)   ( Semigroup a, Semigroup b) => Semigroup (a, b)   Semigroup a => Semigroup ( Const a b)   Ord k => Semigroup ( Map k v)   ( Hashable k, Eq k) => Semigroup ( HashMap k a)   ( Semigroup a, Semigroup b, Semigroup c) => Semigroup (a, b, c)   ( Semigroup a, Semigroup b, Semigroup c, Semigroup d) => Semigroup (a, b, c, d)   ( Semigroup a, Semigroup b, Semigroup c, Semigroup d, Semigroup e) => Semigroup (a, b, c, d, e)   Semigroups newtype Min a Source Constructors Min   Fields getMin :: a   Instances Monad Min   Functor Min   Typeable1 Min   MonadFix Min   Applicative Min   Foldable Min   Traversable Min   Bounded a => Bounded ( Min a)   Enum a => Enum ( Min a)   Eq a => Eq ( Min a)   Data a => Data ( Min a)   Ord a => Ord ( Min a)   Read a => Read ( Min a)   Show a => Show ( Min a)   Generic ( Min a)   ( Ord a, Bounded a) => Monoid ( Min a)   Hashable a => Hashable ( Min a)   Ord a => Semigroup ( Min a)   newtype Max a Source Constructors Max   Fields getMax :: a   Instances Monad Max   Functor Max   Typeable1 Max   MonadFix Max   Applicative Max   Foldable Max   Traversable Max   Bounded a => Bounded ( Max a)   Enum a => Enum ( Max a)   Eq a => Eq ( Max a)   Data a => Data ( Max a)   Ord a => Ord ( Max a)   Read a => Read ( Max a)   Show a => Show ( Max a)   Generic ( Max a)   ( Ord a, Bounded a) => Monoid ( Max a)   Hashable a => Hashable ( Max a)   Ord a => Semigroup ( Max a)   newtype First a Source Use Option ( First a) to get the behavior of First from Data.Monoid . Constructors First   Fields getFirst :: a   Instances Monad First   Functor First   Typeable1 First   MonadFix First   Applicative First   Foldable First   Traversable First   Bounded a => Bounded ( First a)   Enum a => Enum ( First a)   Eq a => Eq ( First a)   Data a => Data ( First a)   Ord a => Ord ( First a)   Read a => Read ( First a)   Show a => Show ( First a)   Generic ( First a)   Hashable a => Hashable ( First a)   Semigroup ( First a)   newtype Last a Source Use Option ( Last a) to get the behavior of Last from Data.Monoid Constructors Last   Fields getLast :: a   Instances Monad Last   Functor Last   Typeable1 Last   MonadFix Last   Applicative Last   Foldable Last   Traversable Last   Bounded a => Bounded ( Last a)   Enum a => Enum ( Last a)   Eq a => Eq ( Last a)   Data a => Data ( Last a)   Ord a => Ord ( Last a)   Read a => Read ( Last a)   Show a => Show ( Last a)   Generic ( Last a)   Hashable a => Hashable ( Last a)   Semigroup ( Last a)   newtype WrappedMonoid m Source Provide a Semigroup for an arbitrary Monoid. Constructors WrapMonoid   Fields unwrapMonoid :: m   Instances Typeable1 WrappedMonoid   Bounded a => Bounded ( WrappedMonoid a)   Enum a => Enum ( WrappedMonoid a)   Eq m => Eq ( WrappedMonoid m)   Data m => Data ( WrappedMonoid m)   Ord m => Ord ( WrappedMonoid m)   Read m => Read ( WrappedMonoid m)   Show m => Show ( WrappedMonoid m)   Generic ( WrappedMonoid m)   Monoid m => Monoid ( WrappedMonoid m)   Hashable a => Hashable ( WrappedMonoid a)   Monoid m => Semigroup ( WrappedMonoid m)   timesN :: ( Whole n, Monoid a) => n -> a -> a Source Repeat a value n times. timesN n a = a <> a <> ... <> a -- using <> (n-1) times Implemented using times1p . Re-exported monoids from Data.Monoid class Monoid a where The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws: mappend mempty x = x mappend x mempty = x mappend x (mappend y z) = mappend (mappend x y) z mconcat = foldr mappend mempty The method names refer to the monoid of lists under concatenation, but there are many other instances. Minimal complete definition: mempty and mappend . Some types can be viewed as a monoid in more than one way, e.g. both addition and multiplication on numbers. In such cases we often define newtype s and make those instances of Monoid , e.g. Sum and Product . Methods mempty :: a Identity of mappend mappend :: a -> a -> a An associative operation mconcat :: [a] -> a Fold a list using the monoid. For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types. Instances Monoid Ordering   Monoid ()   Monoid All   Monoid Any   Monoid ByteString   Monoid ByteString   Monoid IntSet   Monoid Text   Monoid Text   Monoid [a]   Monoid a => Monoid ( Dual a)   Monoid ( Endo a)   Num a => Monoid ( Sum a)   Num a => Monoid ( Product a)   Monoid ( First a)   Monoid ( Last a)   Monoid a => Monoid ( Maybe a) Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid : "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S ." Since there is no "Semigroup" typeclass providing just mappend , we use Monoid instead. Monoid ( Seq a)   Monoid ( IntMap a)   Ord a => Monoid ( Set a)   ( Hashable a, Eq a) => Monoid ( HashSet a)   Semigroup a => Monoid ( Option a)   Monoid m => Monoid ( WrappedMonoid m)   ( Ord a, Bounded a) => Monoid ( Max a)   ( Ord a, Bounded a) => Monoid ( Min a)   Monoid b => Monoid (a -> b)   ( Monoid a, Monoid b) => Monoid (a, b)   Ord k => Monoid ( Map k v)   ( Eq k, Hashable k) => Monoid ( HashMap k v)   ( Monoid a, Monoid b, Monoid c) => Monoid (a, b, c)   ( Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d)   ( Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e)   newtype Dual a The dual of a monoid, obtained by swapping the arguments of mappend . Constructors Dual   Fields getDual :: a   Instances Bounded a => Bounded ( Dual a)   Eq a => Eq ( Dual a)   Ord a => Ord ( Dual a)   Read a => Read ( Dual a)   Show a => Show ( Dual a)   Monoid a => Monoid ( Dual a)   Semigroup a => Semigroup ( Dual a)   newtype Endo a The monoid of endomorphisms under composition. Constructors Endo   Fields appEndo :: a -> a   Instances Monoid ( Endo a)   Semigroup ( Endo a)   newtype All Boolean monoid under conjunction. Constructors All   Fields getAll :: Bool   Instances Bounded All   Eq All   Ord All   Read All   Show All   Monoid All   Semigroup All   newtype Any Boolean monoid under disjunction. Constructors Any   Fields getAny :: Bool   Instances Bounded Any   Eq Any   Ord Any   Read Any   Show Any   Monoid Any   Semigroup Any   newtype Sum a Monoid under addition. Constructors Sum   Fields getSum :: a   Instances Bounded a => Bounded ( Sum a)   Eq a => Eq ( Sum a)   Ord a => Ord ( Sum a)   Read a => Read ( Sum a)   Show a => Show ( Sum a)   Num a => Monoid ( Sum a)   Num a => Semigroup ( Sum a)   newtype Product a Monoid under multiplication. Constructors Product   Fields getProduct :: a   Instances Bounded a => Bounded ( Product a)   Eq a => Eq ( Product a)   Ord a => Ord ( Product a)   Read a => Read ( Product a)   Show a => Show ( Product a)   Num a => Monoid ( Product a)   Num a => Semigroup ( Product a)   A better monoid for Maybe newtype Option a Source Option is effectively Maybe with a better instance of Monoid , built off of an underlying Semigroup instead of an underlying Monoid . Ideally, this type would not exist at all and we would just fix the Monoid instance of Maybe Constructors Option   Fields getOption :: Maybe a   Instances Monad Option   Functor Option   Typeable1 Option   MonadFix Option   MonadPlus Option   Applicative Option   Foldable Option   Traversable Option   Alternative Option   Eq a => Eq ( Option a)   Data a => Data ( Option a)   Ord a => Ord ( Option a)   Read a => Read ( Option a)   Show a => Show ( Option a)   Generic ( Option a)   Semigroup a => Monoid ( Option a)   Hashable a => Hashable ( Option a)   Semigroup a => Semigroup ( Option a)   option :: b -> (a -> b) -> Option a -> b Source Fold an Option case-wise, just like maybe . Difference lists of a semigroup diff :: Semigroup m => m -> Endo m Source This lets you use a difference list of a Semigroup as a Monoid . cycle1 :: Semigroup m => m -> m Source A generalization of cycle to an arbitrary Semigroup . May fail to terminate for some values in some semigroups. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/pg_auto_parameterize_rb.html
pg_auto_parameterize.rb pg_auto_parameterize.rb lib/sequel/extensions/pg_auto_parameterize.rb This extension changes Sequel’s postgres adapter to automatically parameterize queries by default. Sequel’s default behavior has always been to literalize all arguments unless specifically using parameters (via :$arg placeholders and the Dataset#prepare/call methods). This extension makes Sequel use string, numeric, blob, date, and time types as parameters. Example: # Default DB [ :test ]. where ( :a => 1 ) # SQL: SELECT * FROM test WHERE a = 1 DB . extension :pg_auto_parameterize DB [ :test ]. where ( :a => 1 ) # SQL: SELECT * FROM test WHERE a = $1 (args: [1]) Other pg_* extensions that ship with Sequel and add support for PostgreSQL-specific types support automatically parameterizing those types when used with this extension. This extension is not generally faster than the default behavior. In some cases it is faster, such as when using large strings. However, the use of parameters avoids potential security issues, in case Sequel does not correctly literalize one of the arguments that this extension would automatically parameterize. There are some known issues with automatic parameterization: In order to avoid most type errors, the extension attempts to guess the appropriate type and automatically casts most placeholders, except plain Ruby strings (which PostgreSQL treats as an unknown type). Unfortunately, if the type guess is incorrect, or a plain Ruby string is used and PostgreSQL cannot determine the data type for it, the query may result in a DatabaseError. To fix both issues, you can explicitly cast values using Sequel.cast(value, type) , and Sequel will cast to that type. PostgreSQL supports a maximum of 65535 parameters per query. Attempts to use a query with more than this number of parameters will result in a Sequel::DatabaseError being raised. Sequel tries to mitigate this issue by turning column IN (int, ...) queries into column = ANY(CAST($ AS int8[])) using an array parameter, to reduce the number of parameters. It also limits inserting multiple rows at once to a maximum of 40 rows per query by default. While these mitigations handle the most common cases where a large number of parameters would be used, there are other cases. Automatic parameterization will consider the same objects as equivalent when building SQL. However, for performance, it does not perform equality checks. So code such as: DB [ :t ]. select { foo ( 'a' ). as ( :f )}. group { foo ( 'a' )} # SELECT foo('a') AS "f" FROM "t" GROUP BY foo('a') Will get auto paramterized as: # SELECT foo($1) AS "f" FROM "t" GROUP BY foo($2) Which will result in a DatabaseError, since that is not valid SQL. If you use the same expression, it will use the same parameter: foo = Sequel . function ( :foo , 'a' ) DB [ :t ]. select ( foo . as ( :f )). group ( foo ) # SELECT foo($1) AS "f" FROM "t" GROUP BY foo($1) Note that Dataset#select_group and similar methods that take arguments used in multiple places in the SQL will generally handle this automatically, since they will use the same objects: DB [ :t ]. select_group { foo ( 'a' ). as ( :f )} # SELECT foo($1) AS "f" FROM "t" GROUP BY foo($1) You can work around any issues that come up by disabling automatic parameterization by calling the no_auto_parameterize method on the dataset (which returns a clone of the dataset). You can avoid parameterization for specific values in the query by wrapping them with Sequel.skip_pg_auto_param . It is likely there are corner cases not mentioned above when using this extension. Users are encouraged to provide feedback when using this extension if they come across such corner cases. This extension is only compatible when using the pg driver, not when using the sequel-postgres-pr, jeremyevans-postgres-pr, or postgres-pr drivers, as those do not support bound variables. Related module: Sequel::Postgres::AutoParameterize Hanna RDoc template
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Functor-Alt.html
src/Data/Functor/Alt.hs {-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} #endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Alt -- Copyright : (C) 2011 Edward Kmett, -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com> -- Stability : provisional -- Portability : portable -- ---------------------------------------------------------------------------- module Data . Functor . Alt ( Alt ( .. ) , module Data . Functor . Apply ) where import Control . Applicative hiding ( some , many ) import Control . Arrow import Control . Exception ( catch , SomeException ) import Control . Monad import Control . Monad . Trans . Identity import Control . Monad . Trans . Error import Control . Monad . Trans . List import Control . Monad . Trans . Maybe import Control . Monad . Trans . Reader import qualified Control . Monad . Trans . RWS . Strict as Strict import qualified Control . Monad . Trans . State . Strict as Strict import qualified Control . Monad . Trans . Writer . Strict as Strict import qualified Control . Monad . Trans . RWS . Lazy as Lazy import qualified Control . Monad . Trans . State . Lazy as Lazy import qualified Control . Monad . Trans . Writer . Lazy as Lazy import Data . Functor . Apply import Data . Functor . Bind import Data . Semigroup import Data . List . NonEmpty ( NonEmpty ( .. ) ) import Prelude ( ( $ ) , Either ( .. ) , Maybe ( .. ) , const , IO , Ord , ( ++ ) ) #ifdef MIN_VERSION_containers import qualified Data . IntMap as IntMap import Data . IntMap ( IntMap ) import Data . Sequence ( Seq ) import qualified Data . Map as Map import Data . Map ( Map ) #endif infixl 3 <!> -- | Laws: -- -- > <!> is associative: (a <!> b) <!> c = a <!> (b <!> c) -- > <$> left-distributes over <!>: f <$> (a <!> b) = (f <$> a) <!> (f <$> b) -- -- If extended to an 'Alternative' then '<!>' should equal '<|>'. -- -- Ideally, an instance of 'Alt' also satisfies the \"left distributon\" law of -- MonadPlus with respect to <.>: -- -- > <.> right-distributes over <!>: (a <!> b) <.> c = (a <.> c) <!> (b <.> c) -- -- But 'Maybe', 'IO', @'Either' a@, @'ErrorT' e m@, and 'STM' satisfy the alternative -- \"left catch\" law instead: -- -- > pure a <!> b = pure a -- -- However, this variation cannot be stated purely in terms of the dependencies of 'Alt'. -- -- When and if MonadPlus is successfully refactored, this class should also -- be refactored to remove these instances. -- -- The right distributive law should extend in the cases where the a 'Bind' or 'Monad' is -- provided to yield variations of the right distributive law: -- -- > (m <!> n) >>- f = (m >>- f) <!> (m >>- f) -- > (m <!> n) >>= f = (m >>= f) <!> (m >>= f) class Functor f => Alt f where -- | @(<|>)@ without a required @empty@ ( <!> ) :: f a -> f a -> f a some :: Applicative f => f a -> f [ a ] some v = some_v where many_v = some_v <!> pure [] some_v = ( : ) <$> v <*> many_v many :: Applicative f => f a -> f [ a ] many v = many_v where many_v = some_v <!> pure [] some_v = ( : ) <$> v <*> many_v instance Alt ( Either a ) where Left _ <!> b = b a <!> _ = a -- | This instance does not actually satisfy the (<.>) right distributive law -- It instead satisfies the "Left-Catch" law instance Alt IO where m <!> n = catch m ( go n ) where go :: x -> SomeException -> x go = const instance Alt [] where ( <!> ) = ( ++ ) instance Alt Maybe where Nothing <!> b = b a <!> _ = a instance Alt Option where ( <!> ) = ( <|> ) instance MonadPlus m => Alt ( WrappedMonad m ) where ( <!> ) = ( <|> ) instance ArrowPlus a => Alt ( WrappedArrow a b ) where ( <!> ) = ( <|> ) #ifdef MIN_VERSION_containers instance Ord k => Alt ( Map k ) where ( <!> ) = Map . union instance Alt IntMap where ( <!> ) = IntMap . union instance Alt Seq where ( <!> ) = mappend #endif instance Alt NonEmpty where ( a :| as ) <!> ~ ( b :| bs ) = a :| ( as ++ b : bs ) instance Alternative f => Alt ( WrappedApplicative f ) where WrapApplicative a <!> WrapApplicative b = WrapApplicative ( a <|> b ) instance Alt f => Alt ( IdentityT f ) where IdentityT a <!> IdentityT b = IdentityT ( a <!> b ) instance Alt f => Alt ( ReaderT e f ) where ReaderT a <!> ReaderT b = ReaderT $ \ e -> a e <!> b e instance ( Bind f , Monad f ) => Alt ( MaybeT f ) where MaybeT a <!> MaybeT b = MaybeT $ do v <- a case v of Nothing -> b Just _ -> return v instance ( Bind f , Monad f ) => Alt ( ErrorT e f ) where ErrorT m <!> ErrorT n = ErrorT $ do a <- m case a of Left _ -> n Right r -> return ( Right r ) instance Apply f => Alt ( ListT f ) where ListT a <!> ListT b = ListT $ ( <!> ) <$> a <.> b instance Alt f => Alt ( Strict . StateT e f ) where Strict . StateT m <!> Strict . StateT n = Strict . StateT $ \ s -> m s <!> n s instance Alt f => Alt ( Lazy . StateT e f ) where Lazy . StateT m <!> Lazy . StateT n = Lazy . StateT $ \ s -> m s <!> n s instance Alt f => Alt ( Strict . WriterT w f ) where Strict . WriterT m <!> Strict . WriterT n = Strict . WriterT $ m <!> n instance Alt f => Alt ( Lazy . WriterT w f ) where Lazy . WriterT m <!> Lazy . WriterT n = Lazy . WriterT $ m <!> n instance Alt f => Alt ( Strict . RWST r w s f ) where Strict . RWST m <!> Strict . RWST n = Strict . RWST $ \ r s -> m r s <!> n r s instance Alt f => Alt ( Lazy . RWST r w s f ) where Lazy . RWST m <!> Lazy . RWST n = Lazy . RWST $ \ r s -> m r s <!> n r s
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Monoid.html#t:Monoid
Data.Monoid Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability experimental Maintainer libraries@haskell.org Safe Haskell Trustworthy Data.Monoid Contents Monoid typeclass Bool wrappers Num wrappers Maybe wrappers Description A class for monoids (types with an associative binary operation that has an identity) with various general-purpose instances. Synopsis class Monoid a where mempty :: a mappend :: a -> a -> a mconcat :: [a] -> a (<>) :: Monoid m => m -> m -> m newtype Dual a = Dual { getDual :: a } newtype Endo a = Endo { appEndo :: a -> a } newtype All = All { getAll :: Bool } newtype Any = Any { getAny :: Bool } newtype Sum a = Sum { getSum :: a } newtype Product a = Product { getProduct :: a } newtype First a = First { getFirst :: Maybe a } newtype Last a = Last { getLast :: Maybe a } Monoid typeclass class Monoid a where Source The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws: mappend mempty x = x mappend x mempty = x mappend x (mappend y z) = mappend (mappend x y) z mconcat = foldr mappend mempty The method names refer to the monoid of lists under concatenation, but there are many other instances. Minimal complete definition: mempty and mappend . Some types can be viewed as a monoid in more than one way, e.g. both addition and multiplication on numbers. In such cases we often define newtype s and make those instances of Monoid , e.g. Sum and Product . Methods mempty :: a Source Identity of mappend mappend :: a -> a -> a Source An associative operation mconcat :: [a] -> a Source Fold a list using the monoid. For most types, the default definition for mconcat will be used, but the function is included in the class definition so that an optimized version can be provided for specific types. Instances Monoid Ordering   Monoid ()   Monoid Any   Monoid All   Monoid Event   Monoid [a]   Monoid a => Monoid ( Maybe a) Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid : "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S ." Since there is no "Semigroup" typeclass providing just mappend , we use Monoid instead. Monoid ( Last a)   Monoid ( First a)   Num a => Monoid ( Product a)   Num a => Monoid ( Sum a)   Monoid ( Endo a)   Monoid a => Monoid ( Dual a)   Monoid b => Monoid (a -> b)   ( Monoid a, Monoid b) => Monoid (a, b)   ( Monoid a, Monoid b, Monoid c) => Monoid (a, b, c)   ( Monoid a, Monoid b, Monoid c, Monoid d) => Monoid (a, b, c, d)   ( Monoid a, Monoid b, Monoid c, Monoid d, Monoid e) => Monoid (a, b, c, d, e)   (<>) :: Monoid m => m -> m -> m Source An infix synonym for mappend . newtype Dual a Source The dual of a monoid, obtained by swapping the arguments of mappend . Constructors Dual   Fields getDual :: a   Instances Bounded a => Bounded ( Dual a)   Eq a => Eq ( Dual a)   Ord a => Ord ( Dual a)   Read a => Read ( Dual a)   Show a => Show ( Dual a)   Monoid a => Monoid ( Dual a)   newtype Endo a Source The monoid of endomorphisms under composition. Constructors Endo   Fields appEndo :: a -> a   Instances Monoid ( Endo a)   Bool wrappers newtype All Source Boolean monoid under conjunction. Constructors All   Fields getAll :: Bool   Instances Bounded All   Eq All   Ord All   Read All   Show All   Monoid All   newtype Any Source Boolean monoid under disjunction. Constructors Any   Fields getAny :: Bool   Instances Bounded Any   Eq Any   Ord Any   Read Any   Show Any   Monoid Any   Num wrappers newtype Sum a Source Monoid under addition. Constructors Sum   Fields getSum :: a   Instances Bounded a => Bounded ( Sum a)   Eq a => Eq ( Sum a)   Ord a => Ord ( Sum a)   Read a => Read ( Sum a)   Show a => Show ( Sum a)   Num a => Monoid ( Sum a)   newtype Product a Source Monoid under multiplication. Constructors Product   Fields getProduct :: a   Instances Bounded a => Bounded ( Product a)   Eq a => Eq ( Product a)   Ord a => Ord ( Product a)   Read a => Read ( Product a)   Show a => Show ( Product a)   Num a => Monoid ( Product a)   Maybe wrappers To implement find or findLast on any Foldable : findLast :: Foldable t => (a -> Bool) -> t a -> Maybe a findLast pred = getLast . foldMap (x -> if pred x then Last (Just x) else Last Nothing) Much of Data.Map's interface can be implemented with Data.Map.alter. Some of the rest can be implemented with a new alterA function and either First or Last : alterA :: (Applicative f, Ord k) => (Maybe a -> f (Maybe a)) -> k -> Map k a -> f (Map k a) instance Monoid a => Applicative ((,) a) -- from Control.Applicative insertLookupWithKey :: Ord k => (k -> v -> v -> v) -> k -> v -> Map k v -> (Maybe v, Map k v) insertLookupWithKey combine key value = Arrow.first getFirst . alterA doChange key where doChange Nothing = (First Nothing, Just value) doChange (Just oldValue) = (First (Just oldValue), Just (combine key value oldValue)) newtype First a Source Maybe monoid returning the leftmost non-Nothing value. Constructors First   Fields getFirst :: Maybe a   Instances Eq a => Eq ( First a)   Ord a => Ord ( First a)   Read a => Read ( First a)   Show a => Show ( First a)   Monoid ( First a)   newtype Last a Source Maybe monoid returning the rightmost non-Nothing value. Constructors Last   Fields getLast :: Maybe a   Instances Eq a => Eq ( Last a)   Ord a => Ord ( Last a)   Read a => Read ( Last a)   Show a => Show ( Last a)   Monoid ( Last a)   Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/System-IO.html#t:IO
System.IO Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability stable Maintainer libraries@haskell.org Safe Haskell Trustworthy System.IO Contents The IO monad Files and handles Standard handles Opening and closing files Opening files Closing files Special cases File locking Operations on handles Determining and changing the size of a file Detecting the end of input Buffering operations Repositioning handles Handle properties Terminal operations (not portable: GHC/Hugs only) Showing handle state (not portable: GHC only) Text input and output Text input Text output Special cases for standard input and output Binary input and output Temporary files Unicode encoding/decoding Unicode encodings Newline conversion Description The standard IO library. Synopsis data IO a fixIO :: (a -> IO a) -> IO a type FilePath = String data Handle stdin :: Handle stdout :: Handle stderr :: Handle withFile :: FilePath -> IOMode -> ( Handle -> IO r) -> IO r openFile :: FilePath -> IOMode -> IO Handle data IOMode = ReadMode | WriteMode | AppendMode | ReadWriteMode hClose :: Handle -> IO () readFile :: FilePath -> IO String writeFile :: FilePath -> String -> IO () appendFile :: FilePath -> String -> IO () hFileSize :: Handle -> IO Integer hSetFileSize :: Handle -> Integer -> IO () hIsEOF :: Handle -> IO Bool isEOF :: IO Bool data BufferMode = NoBuffering | LineBuffering | BlockBuffering ( Maybe Int ) hSetBuffering :: Handle -> BufferMode -> IO () hGetBuffering :: Handle -> IO BufferMode hFlush :: Handle -> IO () hGetPosn :: Handle -> IO HandlePosn hSetPosn :: HandlePosn -> IO () data HandlePosn hSeek :: Handle -> SeekMode -> Integer -> IO () data SeekMode = AbsoluteSeek | RelativeSeek | SeekFromEnd hTell :: Handle -> IO Integer hIsOpen :: Handle -> IO Bool hIsClosed :: Handle -> IO Bool hIsReadable :: Handle -> IO Bool hIsWritable :: Handle -> IO Bool hIsSeekable :: Handle -> IO Bool hIsTerminalDevice :: Handle -> IO Bool hSetEcho :: Handle -> Bool -> IO () hGetEcho :: Handle -> IO Bool hShow :: Handle -> IO String hWaitForInput :: Handle -> Int -> IO Bool hReady :: Handle -> IO Bool hGetChar :: Handle -> IO Char hGetLine :: Handle -> IO String hLookAhead :: Handle -> IO Char hGetContents :: Handle -> IO String hPutChar :: Handle -> Char -> IO () hPutStr :: Handle -> String -> IO () hPutStrLn :: Handle -> String -> IO () hPrint :: Show a => Handle -> a -> IO () interact :: ( String -> String ) -> IO () putChar :: Char -> IO () putStr :: String -> IO () putStrLn :: String -> IO () print :: Show a => a -> IO () getChar :: IO Char getLine :: IO String getContents :: IO String readIO :: Read a => String -> IO a readLn :: Read a => IO a withBinaryFile :: FilePath -> IOMode -> ( Handle -> IO r) -> IO r openBinaryFile :: FilePath -> IOMode -> IO Handle hSetBinaryMode :: Handle -> Bool -> IO () hPutBuf :: Handle -> Ptr a -> Int -> IO () hGetBuf :: Handle -> Ptr a -> Int -> IO Int hGetBufSome :: Handle -> Ptr a -> Int -> IO Int hPutBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int hGetBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int openTempFile :: FilePath -> String -> IO ( FilePath , Handle ) openBinaryTempFile :: FilePath -> String -> IO ( FilePath , Handle ) openTempFileWithDefaultPermissions :: FilePath -> String -> IO ( FilePath , Handle ) openBinaryTempFileWithDefaultPermissions :: FilePath -> String -> IO ( FilePath , Handle ) hSetEncoding :: Handle -> TextEncoding -> IO () hGetEncoding :: Handle -> IO ( Maybe TextEncoding ) data TextEncoding latin1 :: TextEncoding utf8 :: TextEncoding utf8_bom :: TextEncoding utf16 :: TextEncoding utf16le :: TextEncoding utf16be :: TextEncoding utf32 :: TextEncoding utf32le :: TextEncoding utf32be :: TextEncoding localeEncoding :: TextEncoding char8 :: TextEncoding mkTextEncoding :: String -> IO TextEncoding hSetNewlineMode :: Handle -> NewlineMode -> IO () data Newline = LF | CRLF nativeNewline :: Newline data NewlineMode = NewlineMode { inputNL :: Newline outputNL :: Newline } noNewlineTranslation :: NewlineMode universalNewlineMode :: NewlineMode nativeNewlineMode :: NewlineMode The IO monad data IO a Source A value of type IO a is a computation which, when performed, does some I/O before returning a value of type a . There is really only one way to "perform" an I/O action: bind it to Main.main in your program. When your program is run, the I/O will be performed. It isn't possible to perform I/O from an arbitrary function, unless that function is itself in the IO monad and called at some point, directly or indirectly, from Main.main . IO is a monad, so IO actions can be combined using either the do-notation or the >> and >>= operations from the Monad class. Instances Monad IO   Functor IO   Typeable1 IO   MonadFix IO   Applicative IO   HPrintfType ( IO a)   PrintfType ( IO a)   fixIO :: (a -> IO a) -> IO a Source Files and handles type FilePath = String Source File and directory names are values of type String , whose precise meaning is operating system dependent. Files can be opened, yielding a handle which can then be used to operate on the contents of that file. data Handle Source Haskell defines operations to read and write characters from and to files, represented by values of type Handle . Each value of this type is a handle : a record used by the Haskell run-time system to manage I/O with file system objects. A handle has at least the following properties: whether it manages input or output or both; whether it is open , closed or semi-closed ; whether the object is seekable; whether buffering is disabled, or enabled on a line or block basis; a buffer (whose length may be zero). Most handles will also have a current I/O position indicating where the next input or output operation will occur. A handle is readable if it manages only input or both input and output; likewise, it is writable if it manages only output or both input and output. A handle is open when first allocated. Once it is closed it can no longer be used for either input or output, though an implementation cannot re-use its storage while references remain to it. Handles are in the Show and Eq classes. The string produced by showing a handle is system dependent; it should include enough information to identify the handle for debugging. A handle is equal according to == only to itself; no attempt is made to compare the internal state of different handles for equality. Instances Eq Handle   Show Handle   Typeable Handle   GHC note: a Handle will be automatically closed when the garbage collector detects that it has become unreferenced by the program. However, relying on this behaviour is not generally recommended: the garbage collector is unpredictable. If possible, use an explicit hClose to close Handle s when they are no longer required. GHC does not currently attempt to free up file descriptors when they have run out, it is your responsibility to ensure that this doesn't happen. Standard handles Three handles are allocated during program initialisation, and are initially open. stdin :: Handle Source A handle managing input from the Haskell program's standard input channel. stdout :: Handle Source A handle managing output to the Haskell program's standard output channel. stderr :: Handle Source A handle managing output to the Haskell program's standard error channel. Opening and closing files Opening files withFile :: FilePath -> IOMode -> ( Handle -> IO r) -> IO r Source withFile name mode act opens a file using openFile and passes the resulting handle to the computation act . The handle will be closed on exit from withFile , whether by normal termination or by raising an exception. If closing the handle raises an exception, then this exception will be raised by withFile rather than any exception raised by act . openFile :: FilePath -> IOMode -> IO Handle Source Computation openFile file mode allocates and returns a new, open handle to manage the file file . It manages input if mode is ReadMode , output if mode is WriteMode or AppendMode , and both input and output if mode is ReadWriteMode . If the file does not exist and it is opened for output, it should be created as a new file. If mode is WriteMode and the file already exists, then it should be truncated to zero length. Some operating systems delete empty files, so there is no guarantee that the file will exist following an openFile with mode WriteMode unless it is subsequently written to successfully. The handle is positioned at the end of the file if mode is AppendMode , and otherwise at the beginning (in which case its internal position is 0). The initial buffer mode is implementation-dependent. This operation may fail with: isAlreadyInUseError if the file is already open and cannot be reopened; isDoesNotExistError if the file does not exist; or isPermissionError if the user does not have permission to open the file. Note: if you will be working with files containing binary data, you'll want to be using openBinaryFile . data IOMode Source See openFile Constructors ReadMode   WriteMode   AppendMode   ReadWriteMode   Instances Enum IOMode   Eq IOMode   Ord IOMode   Read IOMode   Show IOMode   Ix IOMode   Closing files hClose :: Handle -> IO () Source Computation hClose hdl makes handle hdl closed. Before the computation finishes, if hdl is writable its buffer is flushed as for hFlush . Performing hClose on a handle that has already been closed has no effect; doing so is not an error. All other operations on a closed handle will fail. If hClose fails for any reason, any further operations (apart from hClose ) on the handle will still fail as if hdl had been successfully closed. Special cases These functions are also exported by the Prelude . readFile :: FilePath -> IO String Source The readFile function reads a file and returns the contents of the file as a string. The file is read lazily, on demand, as with getContents . writeFile :: FilePath -> String -> IO () Source The computation writeFile file str function writes the string str , to the file file . appendFile :: FilePath -> String -> IO () Source The computation appendFile file str function appends the string str , to the file file . Note that writeFile and appendFile write a literal string to a file. To write a value of any printable type, as with print , use the show function to convert the value to a string first. main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]]) File locking Implementations should enforce as far as possible, at least locally to the Haskell process, multiple-reader single-writer locking on files. That is, there may either be many handles on the same file which manage input, or just one handle on the file which manages output . If any open or semi-closed handle is managing a file for output, no new handle can be allocated for that file. If any open or semi-closed handle is managing a file for input, new handles can only be allocated if they do not manage output. Whether two files are the same is implementation-dependent, but they should normally be the same if they have the same absolute path name and neither has been renamed, for example. Warning : the readFile operation holds a semi-closed handle on the file until the entire contents of the file have been consumed. It follows that an attempt to write to a file (using writeFile , for example) that was earlier opened by readFile will usually result in failure with isAlreadyInUseError . Operations on handles Determining and changing the size of a file hFileSize :: Handle -> IO Integer Source For a handle hdl which attached to a physical file, hFileSize hdl returns the size of that file in 8-bit bytes. hSetFileSize :: Handle -> Integer -> IO () Source hSetFileSize hdl size truncates the physical file with handle hdl to size bytes. Detecting the end of input hIsEOF :: Handle -> IO Bool Source For a readable handle hdl , hIsEOF hdl returns True if no further input can be taken from hdl or for a physical file, if the current I/O position is equal to the length of the file. Otherwise, it returns False . NOTE: hIsEOF may block, because it has to attempt to read from the stream to determine whether there is any more data to be read. isEOF :: IO Bool Source The computation isEOF is identical to hIsEOF , except that it works only on stdin . Buffering operations data BufferMode Source Three kinds of buffering are supported: line-buffering, block-buffering or no-buffering. These modes have the following effects. For output, items are written out, or flushed , from the internal buffer according to the buffer mode: line-buffering : the entire output buffer is flushed whenever a newline is output, the buffer overflows, a hFlush is issued, or the handle is closed. block-buffering : the entire buffer is written out whenever it overflows, a hFlush is issued, or the handle is closed. no-buffering : output is written immediately, and never stored in the buffer. An implementation is free to flush the buffer more frequently, but not less frequently, than specified above. The output buffer is emptied as soon as it has been written out. Similarly, input occurs according to the buffer mode for the handle: line-buffering : when the buffer for the handle is not empty, the next item is obtained from the buffer; otherwise, when the buffer is empty, characters up to and including the next newline character are read into the buffer. No characters are available until the newline character is available or the buffer is full. block-buffering : when the buffer for the handle becomes empty, the next block of data is read into the buffer. no-buffering : the next input item is read and returned. The hLookAhead operation implies that even a no-buffered handle may require a one-character buffer. The default buffering mode when a handle is opened is implementation-dependent and may depend on the file system object which is attached to that handle. For most implementations, physical files will normally be block-buffered and terminals will normally be line-buffered. Constructors NoBuffering buffering is disabled if possible. LineBuffering line-buffering should be enabled if possible. BlockBuffering ( Maybe Int ) block-buffering should be enabled if possible. The size of the buffer is n items if the argument is Just n and is otherwise implementation-dependent. Instances Eq BufferMode   Ord BufferMode   Read BufferMode   Show BufferMode   hSetBuffering :: Handle -> BufferMode -> IO () Source Computation hSetBuffering hdl mode sets the mode of buffering for handle hdl on subsequent reads and writes. If the buffer mode is changed from BlockBuffering or LineBuffering to NoBuffering , then if hdl is writable, the buffer is flushed as for hFlush ; if hdl is not writable, the contents of the buffer is discarded. This operation may fail with: isPermissionError if the handle has already been used for reading or writing and the implementation does not allow the buffering mode to be changed. hGetBuffering :: Handle -> IO BufferMode Source Computation hGetBuffering hdl returns the current buffering mode for hdl . hFlush :: Handle -> IO () Source The action hFlush hdl causes any items buffered for output in handle hdl to be sent immediately to the operating system. This operation may fail with: isFullError if the device is full; isPermissionError if a system resource limit would be exceeded. It is unspecified whether the characters in the buffer are discarded or retained under these circumstances. Repositioning handles hGetPosn :: Handle -> IO HandlePosn Source Computation hGetPosn hdl returns the current I/O position of hdl as a value of the abstract type HandlePosn . hSetPosn :: HandlePosn -> IO () Source If a call to hGetPosn hdl returns a position p , then computation hSetPosn p sets the position of hdl to the position it held at the time of the call to hGetPosn . This operation may fail with: isPermissionError if a system resource limit would be exceeded. data HandlePosn Source Instances Eq HandlePosn   Show HandlePosn   hSeek :: Handle -> SeekMode -> Integer -> IO () Source Computation hSeek hdl mode i sets the position of handle hdl depending on mode . The offset i is given in terms of 8-bit bytes. If hdl is block- or line-buffered, then seeking to a position which is not in the current buffer will first cause any items in the output buffer to be written to the device, and then cause the input buffer to be discarded. Some handles may not be seekable (see hIsSeekable ), or only support a subset of the possible positioning operations (for instance, it may only be possible to seek to the end of a tape, or to a positive offset from the beginning or current position). It is not possible to set a negative I/O position, or for a physical file, an I/O position beyond the current end-of-file. This operation may fail with: isIllegalOperationError if the Handle is not seekable, or does not support the requested seek mode. isPermissionError if a system resource limit would be exceeded. data SeekMode Source A mode that determines the effect of hSeek hdl mode i . Constructors AbsoluteSeek the position of hdl is set to i . RelativeSeek the position of hdl is set to offset i from the current position. SeekFromEnd the position of hdl is set to offset i from the end of the file. Instances Enum SeekMode   Eq SeekMode   Ord SeekMode   Read SeekMode   Show SeekMode   Ix SeekMode   hTell :: Handle -> IO Integer Source Computation hTell hdl returns the current position of the handle hdl , as the number of bytes from the beginning of the file. The value returned may be subsequently passed to hSeek to reposition the handle to the current position. This operation may fail with: isIllegalOperationError if the Handle is not seekable. Handle properties hIsOpen :: Handle -> IO Bool Source hIsClosed :: Handle -> IO Bool Source hIsReadable :: Handle -> IO Bool Source hIsWritable :: Handle -> IO Bool Source hIsSeekable :: Handle -> IO Bool Source Terminal operations (not portable: GHC/Hugs only) hIsTerminalDevice :: Handle -> IO Bool Source Is the handle connected to a terminal? hSetEcho :: Handle -> Bool -> IO () Source Set the echoing status of a handle connected to a terminal. hGetEcho :: Handle -> IO Bool Source Get the echoing status of a handle connected to a terminal. Showing handle state (not portable: GHC only) hShow :: Handle -> IO String Source hShow is in the IO monad, and gives more comprehensive output than the (pure) instance of Show for Handle . Text input and output Text input hWaitForInput :: Handle -> Int -> IO Bool Source Computation hWaitForInput hdl t waits until input is available on handle hdl . It returns True as soon as input is available on hdl , or False if no input is available within t milliseconds. Note that hWaitForInput waits until one or more full characters are available, which means that it needs to do decoding, and hence may fail with a decoding error. If t is less than zero, then hWaitForInput waits indefinitely. This operation may fail with: isEOFError if the end of file has been reached. a decoding error, if the input begins with an invalid byte sequence in this Handle's encoding. NOTE for GHC users: unless you use the -threaded flag, hWaitForInput t where t >= 0 will block all other Haskell threads for the duration of the call. It behaves like a safe foreign call in this respect. hReady :: Handle -> IO Bool Source Computation hReady hdl indicates whether at least one item is available for input from handle hdl . This operation may fail with: isEOFError if the end of file has been reached. hGetChar :: Handle -> IO Char Source Computation hGetChar hdl reads a character from the file or channel managed by hdl , blocking until a character is available. This operation may fail with: isEOFError if the end of file has been reached. hGetLine :: Handle -> IO String Source Computation hGetLine hdl reads a line from the file or channel managed by hdl . This operation may fail with: isEOFError if the end of file is encountered when reading the first character of the line. If hGetLine encounters end-of-file at any other point while reading in a line, it is treated as a line terminator and the (partial) line is returned. hLookAhead :: Handle -> IO Char Source Computation hLookAhead returns the next character from the handle without removing it from the input buffer, blocking until a character is available. This operation may fail with: isEOFError if the end of file has been reached. hGetContents :: Handle -> IO String Source Computation hGetContents hdl returns the list of characters corresponding to the unread portion of the channel or file managed by hdl , which is put into an intermediate state, semi-closed . In this state, hdl is effectively closed, but items are read from hdl on demand and accumulated in a special list returned by hGetContents hdl . Any operation that fails because a handle is closed, also fails if a handle is semi-closed. The only exception is hClose . A semi-closed handle becomes closed: if hClose is applied to it; if an I/O error occurs when reading an item from the handle; or once the entire contents of the handle has been read. Once a semi-closed handle becomes closed, the contents of the associated list becomes fixed. The contents of this final list is only partially specified: it will contain at least all the items of the stream that were evaluated prior to the handle becoming closed. Any I/O errors encountered while a handle is semi-closed are simply discarded. This operation may fail with: isEOFError if the end of file has been reached. Text output hPutChar :: Handle -> Char -> IO () Source Computation hPutChar hdl ch writes the character ch to the file or channel managed by hdl . Characters may be buffered if buffering is enabled for hdl . This operation may fail with: isFullError if the device is full; or isPermissionError if another system resource limit would be exceeded. hPutStr :: Handle -> String -> IO () Source Computation hPutStr hdl s writes the string s to the file or channel managed by hdl . This operation may fail with: isFullError if the device is full; or isPermissionError if another system resource limit would be exceeded. hPutStrLn :: Handle -> String -> IO () Source The same as hPutStr , but adds a newline character. hPrint :: Show a => Handle -> a -> IO () Source Computation hPrint hdl t writes the string representation of t given by the shows function to the file or channel managed by hdl and appends a newline. This operation may fail with: isFullError if the device is full; or isPermissionError if another system resource limit would be exceeded. Special cases for standard input and output These functions are also exported by the Prelude . interact :: ( String -> String ) -> IO () Source The interact function takes a function of type String->String as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device. putChar :: Char -> IO () Source Write a character to the standard output device (same as hPutChar stdout ). putStr :: String -> IO () Source Write a string to the standard output device (same as hPutStr stdout ). putStrLn :: String -> IO () Source The same as putStr , but adds a newline character. print :: Show a => a -> IO () Source The print function outputs a value of any printable type to the standard output device. Printable types are those that are instances of class Show ; print converts values to strings for output using the show operation and adds a newline. For example, a program to print the first 20 integers and their powers of 2 could be written as: main = print ([(n, 2^n) | n <- [0..19]]) getChar :: IO Char Source Read a character from the standard input device (same as hGetChar stdin ). getLine :: IO String Source Read a line from the standard input device (same as hGetLine stdin ). getContents :: IO String Source The getContents operation returns all user input as a single string, which is read lazily as it is needed (same as hGetContents stdin ). readIO :: Read a => String -> IO a Source The readIO function is similar to read except that it signals parse failure to the IO monad instead of terminating the program. readLn :: Read a => IO a Source The readLn function combines getLine and readIO . Binary input and output withBinaryFile :: FilePath -> IOMode -> ( Handle -> IO r) -> IO r Source withBinaryFile name mode act opens a file using openBinaryFile and passes the resulting handle to the computation act . The handle will be closed on exit from withBinaryFile , whether by normal termination or by raising an exception. openBinaryFile :: FilePath -> IOMode -> IO Handle Source Like openFile , but open the file in binary mode. On Windows, reading a file in text mode (which is the default) will translate CRLF to LF, and writing will translate LF to CRLF. This is usually what you want with text files. With binary files this is undesirable; also, as usual under Microsoft operating systems, text mode treats control-Z as EOF. Binary mode turns off all special treatment of end-of-line and end-of-file characters. (See also hSetBinaryMode .) hSetBinaryMode :: Handle -> Bool -> IO () Source Select binary mode ( True ) or text mode ( False ) on a open handle. (See also openBinaryFile .) This has the same effect as calling hSetEncoding with char8 , together with hSetNewlineMode with noNewlineTranslation . hPutBuf :: Handle -> Ptr a -> Int -> IO () Source hPutBuf hdl buf count writes count 8-bit bytes from the buffer buf to the handle hdl . It returns (). hPutBuf ignores any text encoding that applies to the Handle , writing the bytes directly to the underlying file or device. hPutBuf ignores the prevailing TextEncoding and NewlineMode on the Handle , and writes bytes directly. This operation may fail with: ResourceVanished if the handle is a pipe or socket, and the reading end is closed. (If this is a POSIX system, and the program has not asked to ignore SIGPIPE, then a SIGPIPE may be delivered instead, whose default action is to terminate the program). hGetBuf :: Handle -> Ptr a -> Int -> IO Int Source hGetBuf hdl buf count reads data from the handle hdl into the buffer buf until either EOF is reached or count 8-bit bytes have been read. It returns the number of bytes actually read. This may be zero if EOF was reached before any data was read (or if count is zero). hGetBuf never raises an EOF exception, instead it returns a value smaller than count . If the handle is a pipe or socket, and the writing end is closed, hGetBuf will behave as if EOF was reached. hGetBuf ignores the prevailing TextEncoding and NewlineMode on the Handle , and reads bytes directly. hGetBufSome :: Handle -> Ptr a -> Int -> IO Int Source hGetBufSome hdl buf count reads data from the handle hdl into the buffer buf . If there is any data available to read, then hGetBufSome returns it immediately; it only blocks if there is no data to be read. It returns the number of bytes actually read. This may be zero if EOF was reached before any data was read (or if count is zero). hGetBufSome never raises an EOF exception, instead it returns a value smaller than count . If the handle is a pipe or socket, and the writing end is closed, hGetBufSome will behave as if EOF was reached. hGetBufSome ignores the prevailing TextEncoding and NewlineMode on the Handle , and reads bytes directly. hPutBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int Source hGetBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int Source hGetBufNonBlocking hdl buf count reads data from the handle hdl into the buffer buf until either EOF is reached, or count 8-bit bytes have been read, or there is no more data available to read immediately. hGetBufNonBlocking is identical to hGetBuf , except that it will never block waiting for data to become available, instead it returns only whatever data is available. To wait for data to arrive before calling hGetBufNonBlocking , use hWaitForInput . If the handle is a pipe or socket, and the writing end is closed, hGetBufNonBlocking will behave as if EOF was reached. hGetBufNonBlocking ignores the prevailing TextEncoding and NewlineMode on the Handle , and reads bytes directly. NOTE: on Windows, this function does not work correctly; it behaves identically to hGetBuf . Temporary files openTempFile Source Arguments :: FilePath Directory in which to create the file -> String File name template. If the template is "foo.ext" then the created file will be "fooXXX.ext" where XXX is some random number. -> IO ( FilePath , Handle )   The function creates a temporary file in ReadWrite mode. The created file isn't deleted automatically, so you need to delete it manually. The file is creates with permissions such that only the current user can read/write it. With some exceptions (see below), the file will be created securely in the sense that an attacker should not be able to cause openTempFile to overwrite another file on the filesystem using your credentials, by putting symbolic links (on Unix) in the place where the temporary file is to be created. On Unix the O_CREAT and O_EXCL flags are used to prevent this attack, but note that O_EXCL is sometimes not supported on NFS filesystems, so if you rely on this behaviour it is best to use local filesystems only. openBinaryTempFile :: FilePath -> String -> IO ( FilePath , Handle ) Source Like openTempFile , but opens the file in binary mode. See openBinaryFile for more comments. openTempFileWithDefaultPermissions :: FilePath -> String -> IO ( FilePath , Handle ) Source Like openTempFile , but uses the default file permissions openBinaryTempFileWithDefaultPermissions :: FilePath -> String -> IO ( FilePath , Handle ) Source Like openBinaryTempFile , but uses the default file permissions Unicode encoding/decoding A text-mode Handle has an associated TextEncoding , which is used to decode bytes into Unicode characters when reading, and encode Unicode characters into bytes when writing. The default TextEncoding is the same as the default encoding on your system, which is also available as localeEncoding . (GHC note: on Windows, we currently do not support double-byte encodings; if the console's code page is unsupported, then localeEncoding will be latin1 .) Encoding and decoding errors are always detected and reported, except during lazy I/O ( hGetContents , getContents , and readFile ), where a decoding error merely results in termination of the character stream, as with other I/O errors. hSetEncoding :: Handle -> TextEncoding -> IO () Source The action hSetEncoding hdl encoding changes the text encoding for the handle hdl to encoding . The default encoding when a Handle is created is localeEncoding , namely the default encoding for the current locale. To create a Handle with no encoding at all, use openBinaryFile . To stop further encoding or decoding on an existing Handle , use hSetBinaryMode . hSetEncoding may need to flush buffered data in order to change the encoding. hGetEncoding :: Handle -> IO ( Maybe TextEncoding ) Source Return the current TextEncoding for the specified Handle , or Nothing if the Handle is in binary mode. Note that the TextEncoding remembers nothing about the state of the encoder/decoder in use on this Handle . For example, if the encoding in use is UTF-16, then using hGetEncoding and hSetEncoding to save and restore the encoding may result in an extra byte-order-mark being written to the file. Unicode encodings data TextEncoding Source A TextEncoding is a specification of a conversion scheme between sequences of bytes and sequences of Unicode characters. For example, UTF-8 is an encoding of Unicode characters into a sequence of bytes. The TextEncoding for UTF-8 is utf8 . Instances Show TextEncoding   latin1 :: TextEncoding Source The Latin1 (ISO8859-1) encoding. This encoding maps bytes directly to the first 256 Unicode code points, and is thus not a complete Unicode encoding. An attempt to write a character greater than '\255' to a Handle using the latin1 encoding will result in an error. utf8 :: TextEncoding Source The UTF-8 Unicode encoding utf8_bom :: TextEncoding Source The UTF-8 Unicode encoding, with a byte-order-mark (BOM; the byte sequence 0xEF 0xBB 0xBF). This encoding behaves like utf8 , except that on input, the BOM sequence is ignored at the beginning of the stream, and on output, the BOM sequence is prepended. The byte-order-mark is strictly unnecessary in UTF-8, but is sometimes used to identify the encoding of a file. utf16 :: TextEncoding Source The UTF-16 Unicode encoding (a byte-order-mark should be used to indicate endianness). utf16le :: TextEncoding Source The UTF-16 Unicode encoding (litte-endian) utf16be :: TextEncoding Source The UTF-16 Unicode encoding (big-endian) utf32 :: TextEncoding Source The UTF-32 Unicode encoding (a byte-order-mark should be used to indicate endianness). utf32le :: TextEncoding Source The UTF-32 Unicode encoding (litte-endian) utf32be :: TextEncoding Source The UTF-32 Unicode encoding (big-endian) localeEncoding :: TextEncoding Source The Unicode encoding of the current locale This is the initial locale encoding: if it has been subsequently changed by setLocaleEncoding this value will not reflect that change. char8 :: TextEncoding Source An encoding in which Unicode code points are translated to bytes by taking the code point modulo 256. When decoding, bytes are translated directly into the equivalent code point. This encoding never fails in either direction. However, encoding discards information, so encode followed by decode is not the identity. mkTextEncoding :: String -> IO TextEncoding Source Look up the named Unicode encoding. May fail with isDoesNotExistError if the encoding is unknown The set of known encodings is system-dependent, but includes at least: UTF-8 UTF-16 , UTF-16BE , UTF-16LE UTF-32 , UTF-32BE , UTF-32LE On systems using GNU iconv (e.g. Linux), there is additional notation for specifying how illegal characters are handled: a suffix of //IGNORE , e.g. UTF-8//IGNORE , will cause all illegal sequences on input to be ignored, and on output will drop all code points that have no representation in the target encoding. a suffix of //TRANSLIT will choose a replacement character for illegal sequences or code points. On Windows, you can access supported code pages with the prefix CP ; for example, "CP1250" . Newline conversion In Haskell, a newline is always represented by the character '\n'. However, in files and external character streams, a newline may be represented by another character sequence, such as '\r\n'. A text-mode Handle has an associated NewlineMode that specifies how to transate newline characters. The NewlineMode specifies the input and output translation separately, so that for instance you can translate '\r\n' to '\n' on input, but leave newlines as '\n' on output. The default NewlineMode for a Handle is nativeNewlineMode , which does no translation on Unix systems, but translates '\r\n' to '\n' and back on Windows. Binary-mode Handle s do no newline translation at all. hSetNewlineMode :: Handle -> NewlineMode -> IO () Source Set the NewlineMode on the specified Handle . All buffered data is flushed first. data Newline Source The representation of a newline in the external file or stream. Constructors LF '\n' CRLF '\r\n' Instances Eq Newline   Ord Newline   Read Newline   Show Newline   nativeNewline :: Newline Source The native newline representation for the current platform: LF on Unix systems, CRLF on Windows. data NewlineMode Source Specifies the translation, if any, of newline characters between internal Strings and the external file or stream. Haskell Strings are assumed to represent newlines with the '\n' character; the newline mode specifies how to translate '\n' on output, and what to translate into '\n' on input. Constructors NewlineMode   Fields inputNL :: Newline the representation of newlines on input outputNL :: Newline the representation of newlines on output Instances Eq NewlineMode   Ord NewlineMode   Read NewlineMode   Show NewlineMode   noNewlineTranslation :: NewlineMode Source Do no newline translation at all. noNewlineTranslation = NewlineMode { inputNL = LF, outputNL = LF } universalNewlineMode :: NewlineMode Source Map '\r\n' into '\n' on input, and '\n' to the native newline represetnation on output. This mode can be used on any platform, and works with text files using any newline convention. The downside is that readFile >>= writeFile might yield a different file. universalNewlineMode = NewlineMode { inputNL = CRLF, outputNL = nativeNewline } nativeNewlineMode :: NewlineMode Source Use the native newline representation on both input and output nativeNewlineMode = NewlineMode { inputNL = nativeNewline outputNL = nativeNewline } Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://code.google.com/archive/#content
Google Code Archive - Long-term storage for Google Code Project Hosting. Code Archive Skip to content The Google Code Archive requires JavaScript to be enabled in your browser. Google About Google Privacy Terms
2026-01-13T09:30:24
https://stdapi.ai/use_cases_agents/
Autonomous agents (AutoGPT & more) - stdapi.ai Skip to content stdapi.ai Autonomous agents (AutoGPT & more) Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Autonomous agents (AutoGPT & more) Table of contents About Autonomous AI Agents Popular Agent Frameworks Why Autonomous Agents + stdapi.ai? 🤖 AutoGPT Integration About AutoGPT Configuration Usage 👶 BabyAGI Integration About BabyAGI Configuration Usage 🎭 CrewAI Integration About CrewAI Configuration 🕸️ LangGraph Integration About LangGraph Configuration 🎯 Agent Design Patterns Task Decomposition Tool Usage Memory Management 📊 Model Selection by Agent Task 💡 Best Practices 🚀 Advanced Agent Patterns Multi-Agent Collaboration Feedback Loops 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Roadmap & Changelog API Reference Table of contents About Autonomous AI Agents Popular Agent Frameworks Why Autonomous Agents + stdapi.ai? 🤖 AutoGPT Integration About AutoGPT Configuration Usage 👶 BabyAGI Integration About BabyAGI Configuration Usage 🎭 CrewAI Integration About CrewAI Configuration 🕸️ LangGraph Integration About LangGraph Configuration 🎯 Agent Design Patterns Task Decomposition Tool Usage Memory Management 📊 Model Selection by Agent Task 💡 Best Practices 🚀 Advanced Agent Patterns Multi-Agent Collaboration Feedback Loops 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Home Documentation Use cases Autonomous AI Agents — AutoGPT, BabyAGI & More ¶ Build autonomous AI agents powered by Amazon Bedrock models through stdapi.ai. Deploy self-directed agents that can break down complex tasks, use tools, and work independently—using enterprise-grade models instead of OpenAI. About Autonomous AI Agents ¶ Autonomous agents are AI systems that can independently plan, execute, and refine tasks to achieve goals. Most agent frameworks are built for OpenAI's API, making them perfect candidates for stdapi.ai integration. Popular Agent Frameworks ¶ 🔗 AutoGPT: Website | GitHub | Documentation 🔗 BabyAGI: GitHub | Paper 🔗 AgentGPT: Website | GitHub 🔗 SuperAGI: Website | GitHub 🔗 CrewAI: Website | GitHub | Docs 🔗 LangGraph: Docs | GitHub Why Autonomous Agents + stdapi.ai? ¶ Autonomous AI Run AI agents with Amazon Bedrock models for reasoning, longer context, and full control over your AI infrastructure. Key Benefits: Reasoning - Claude Sonnet excels at planning and complex task breakdown Long context - Amazon Nova Pro supports 300K tokens for extensive agent memory Cost control - AWS pricing for compute-intensive agent operations Privacy & security - Agent data and conversations stay in your AWS environment No rate limits - Avoid OpenAI's strict limits during intensive agent runs Model selection - Choose optimal models for different agent tasks Work in Progress This integration guide is actively being developed and refined. While the configuration examples are based on documented APIs and best practices, they are pending practical validation. Complete end-to-end deployment examples will be added once testing is finalized. 🤖 AutoGPT Integration ¶ About AutoGPT ¶ AutoGPT is one of the most popular autonomous agent projects, capable of breaking down goals into tasks and executing them independently. Installation: git clone https://github.com/Significant-Gravitas/AutoGPT.git cd AutoGPT pip install -r requirements.txt Configuration ¶ .env Configuration Create or edit .env file in the AutoGPT directory: ################################################################################ ### LLM PROVIDER ################################################################################ ## OPENAI (compatible with stdapi.ai) OPENAI_API_KEY = your_stdapi_key_here OPENAI_API_BASE_URL = https://YOUR_SERVER_URL/v1 ## Model selection SMART_LLM = anthropic.claude-sonnet-4-5-20250929-v1:0 FAST_LLM = amazon.nova-lite-v1:0 ## Embeddings EMBEDDING_MODEL = amazon.titan-embed-text-v2:0 ################################################################################ ### MEMORY ################################################################################ MEMORY_BACKEND = json_file # MEMORY_BACKEND=pinecone # For production ################################################################################ ### AGENT SETTINGS ################################################################################ AI_SETTINGS_FILE = ai_settings.yaml AGENT_NAME = AutoGPT-Bedrock Usage ¶ Running AutoGPT # Start AutoGPT python -m autogpt # With custom goal python -m autogpt --goal "Research and summarize the latest AI developments" # Continue previous run python -m autogpt --continue Model Selection Strategy: SMART_LLM — Used for complex reasoning and planning → Claude Sonnet FAST_LLM — Used for simple tasks and confirmations → Nova Lite or Micro 👶 BabyAGI Integration ¶ About BabyAGI ¶ BabyAGI is a minimal autonomous agent that creates, prioritizes, and executes tasks based on objectives. Installation: git clone https://github.com/yoheinakajima/babyagi.git cd babyagi pip install -r requirements.txt Configuration ¶ Python Configuration Edit babyagi.py or use environment variables: import os from openai import OpenAI # Configure OpenAI client for stdapi.ai client = OpenAI ( api_key = os . environ . get ( "STDAPI_KEY" ), base_url = "https://YOUR_SERVER_URL/v1" ) # Agent configuration OBJECTIVE = os . environ . get ( "OBJECTIVE" , "Research sustainable energy solutions" ) INITIAL_TASK = os . environ . get ( "INITIAL_TASK" , "Develop a task list" ) # Model selection LLM_MODEL = "anthropic.claude-sonnet-4-5-20250929-v1:0" EMBEDDING_MODEL = "amazon.titan-embed-text-v2:0" # Task execution function def task_execution_agent ( objective , task ): response = client . chat . completions . create ( model = LLM_MODEL , messages = [ { "role" : "system" , "content" : f "You are an AI agent helping with: { objective } " }, { "role" : "user" , "content" : task } ], max_tokens = 2000 ) return response . choices [ 0 ] . message . content Usage ¶ Running BabyAGI # Set environment variables export STDAPI_KEY = your_key_here export OBJECTIVE = "Create a marketing plan for a new product" # Run agent python babyagi.py 🎭 CrewAI Integration ¶ About CrewAI ¶ CrewAI enables creating teams of AI agents that work together on complex tasks, each with specific roles and goals. Installation: pip install crewai crewai-tools openai Configuration ¶ Python - Multi-Agent Crew import os from crewai import Agent , Task , Crew from langchain_openai import ChatOpenAI # Configure LLM with stdapi.ai llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = os . environ [ "STDAPI_KEY" ], openai_api_base = "https://YOUR_SERVER_URL/v1" ) # Define agents researcher = Agent ( role = "Senior Research Analyst" , goal = "Discover cutting-edge developments in AI" , backstory = "You're an expert at finding and analyzing information" , verbose = True , llm = llm ) writer = Agent ( role = "Tech Content Writer" , goal = "Create engaging content about technology" , backstory = "You're a skilled writer who makes complex topics accessible" , verbose = True , llm = llm ) # Define tasks research_task = Task ( description = "Research the latest trends in AI agents" , agent = researcher , expected_output = "A detailed report on AI agent trends" ) writing_task = Task ( description = "Write a blog post based on the research" , agent = writer , expected_output = "A 500-word engaging blog post" ) # Create crew crew = Crew ( agents = [ researcher , writer ], tasks = [ research_task , writing_task ], verbose = True ) # Execute result = crew . kickoff () print ( result ) 🕸️ LangGraph Integration ¶ About LangGraph ¶ LangGraph is a framework for building stateful, multi-agent applications with complex control flow. Installation: pip install langgraph langchain-openai Configuration ¶ Python - Agent with Memory from typing import TypedDict , Annotated from langgraph.graph import StateGraph , END from langchain_openai import ChatOpenAI import operator import os # Configure LLM llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = os . environ [ "STDAPI_KEY" ], openai_api_base = "https://YOUR_SERVER_URL/v1" ) # Define state class AgentState ( TypedDict ): messages : Annotated [ list , operator . add ] next_action : str # Define nodes def call_model ( state ): messages = state [ "messages" ] response = llm . invoke ( messages ) return { "messages" : [ response ]} def decide_next_action ( state ): # Logic to determine next step last_message = state [ "messages" ][ - 1 ] . content if "FINISH" in last_message : return END return "call_model" # Build graph workflow = StateGraph ( AgentState ) workflow . add_node ( "call_model" , call_model ) workflow . add_edge ( "call_model" , "decide_next_action" ) workflow . set_entry_point ( "call_model" ) app = workflow . compile () # Run agent result = app . invoke ({ "messages" : [{ "role" : "user" , "content" : "Create a research plan" }] }) 🎯 Agent Design Patterns ¶ Task Decomposition ¶ Break complex goals into manageable sub-tasks. Task Planning Pattern def plan_tasks ( objective ): response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : f """Break down this objective into specific tasks: Objective: { objective } Provide a numbered list of 3-5 concrete tasks.""" }] ) return response . choices [ 0 ] . message . content Tool Usage ¶ Enable agents to use external tools and APIs. Agent with Tools from langchain.agents import create_openai_functions_agent , AgentExecutor from langchain.tools import Tool from langchain_openai import ChatOpenAI # Configure LLM llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = os . environ [ "STDAPI_KEY" ], openai_api_base = "https://YOUR_SERVER_URL/v1" ) # Define tools def web_search ( query ): """Search the web for information""" # Your search implementation return f "Search results for: { query } " def calculator ( expression ): """Perform calculations""" try : return str ( eval ( expression )) except : return "Invalid expression" tools = [ Tool ( name = "WebSearch" , func = web_search , description = "Search the web" ), Tool ( name = "Calculator" , func = calculator , description = "Do math" ) ] # Create agent agent = create_openai_functions_agent ( llm , tools , prompt ) agent_executor = AgentExecutor ( agent = agent , tools = tools , verbose = True ) # Run with tools result = agent_executor . invoke ({ "input" : "What is 15 % o f 1250? Then search for that amount in USD" }) Memory Management ¶ Implement different memory types for agent persistence. Memory Types Short-term Memory (Conversation): conversation_history = [] def add_to_memory ( role , content ): conversation_history . append ({ "role" : role , "content" : content }) # Keep last 20 messages return conversation_history [ - 20 :] Long-term Memory (Vector Store): from langchain_community.vectorstores import Chroma from langchain_openai import OpenAIEmbeddings embeddings = OpenAIEmbeddings ( model = "amazon.titan-embed-text-v2:0" , openai_api_key = os . environ [ "STDAPI_KEY" ], openai_api_base = "https://YOUR_SERVER_URL/v1" ) memory_store = Chroma ( embedding_function = embeddings ) def store_memory ( content ): memory_store . add_texts ([ content ]) def recall_memory ( query , k = 3 ): return memory_store . similarity_search ( query , k = k ) 📊 Model Selection by Agent Task ¶ Choose models based on agent task requirements. These are examples —all Bedrock models are available. Agent Task Example Model Why Planning & Strategy anthropic.claude-sonnet-4-5-20250929-v1:0 Superior reasoning and task decomposition Task Execution amazon.nova-lite-v1:0 Fast, efficient for routine tasks Long Context amazon.nova-pro-v1:0 300K token context for extensive memory Code Generation anthropic.claude-sonnet-4-5-20250929-v1:0 Best for writing and debugging code Quick Decisions amazon.nova-micro-v1:0 Fast responses for simple choices Embeddings amazon.titan-embed-text-v2:0 High-quality semantic memory 💡 Best Practices ¶ Agent Design Clear Objectives: Define specific, measurable goals for agents Task Constraints: Set time limits and iteration caps to prevent runaway execution Human-in-the-Loop: Include checkpoints for human review and approval Graceful Failure: Design agents to handle failures and ask for help Performance Optimization Model Selection: Use fast models for simple tasks, premium for complex reasoning Parallel Execution: Run independent tasks concurrently when possible Caching: Cache tool results and API responses to avoid redundant calls Incremental Progress: Save state frequently to resume from failures Safety & Control Sandbox Environment: Test agents in isolated environments first Rate Limiting: Prevent excessive API usage with throttling Action Approval: Require confirmation for destructive actions Logging: Comprehensive logs of all agent actions for debugging Budget Limits: Set token usage caps to control costs Production Deployment Error Handling: Robust error recovery and retry logic State Persistence: Store agent state in databases for resilience Monitoring: Track agent performance, success rates, and costs Version Control: Track agent configurations and prompt changes 🚀 Advanced Agent Patterns ¶ Multi-Agent Collaboration ¶ Have multiple specialized agents work together. Agent Team Pattern # Research agent researcher = Agent ( role = "Researcher" , model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , task = "Gather information" ) # Analyst agent analyst = Agent ( role = "Analyst" , model = "amazon.nova-pro-v1:0" , task = "Analyze data" ) # Writer agent writer = Agent ( role = "Writer" , model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , task = "Create report" ) # Coordinator def coordinate_agents ( objective ): research = researcher . execute ( objective ) analysis = analyst . execute ( research ) report = writer . execute ( analysis ) return report Feedback Loops ¶ Implement self-improvement through iteration. Iterative Refinement def iterative_agent ( task , max_iterations = 3 ): result = initial_attempt ( task ) for i in range ( max_iterations ): critique = critique_result ( result ) if "ACCEPTABLE" in critique : break result = refine_result ( result , critique ) return result 🚀 Next Steps & Resources ¶ Getting Started ¶ Choose Framework: Start with BabyAGI or CrewAI for simpler implementations Define Objectives: Start with small, well-defined goals Configure stdapi.ai: Set up credentials and model preferences Test Safely: Run in sandbox environment with supervision Monitor & Iterate: Track performance and refine agent behavior Learn More ¶ Additional Resources AutoGPT Documentation — Comprehensive agent guide CrewAI Documentation — Multi-agent systems LangGraph Tutorials — Complex agent workflows API Overview — Complete list of available Bedrock models LangChain Integration — Framework integration details Community & Support ¶ Need Help? 💬 Join framework-specific Discord communities 📖 Review Amazon Bedrock documentation for model capabilities 🐛 Report issues on the GitHub repository 💡 Share agent patterns with the community ⚠️ Important Considerations ¶ Model Availability Regional Differences: Not all Amazon Bedrock models are available in every AWS region. Verify model availability before deploying agents. Check availability: See the API Overview for supported models by region. Safety & Ethics Agent Supervision: Always supervise autonomous agents, especially in production Action Limits: Restrict agents from performing destructive or irreversible actions Data Privacy: Ensure agents don't process or expose sensitive information Compliance: Follow applicable regulations for automated decision-making Cost Management Token Usage: Agents can consume many tokens—monitor usage closely Iteration Limits: Set maximum iterations to prevent runaway costs Model Selection: Use efficient models where possible to reduce costs Caching: Cache intermediate results to avoid redundant processing Performance Expectations Response Times: Agents are slower than simple API calls due to iteration Reliability: Agents may fail or produce unexpected results—plan accordingly Determinism: Agent behavior can vary between runs—test thoroughly Scaling: Resource usage scales with task complexity and iteration count Back to top Previous Chat bots (Slack, Discord & Teams) Next Roadmap & Changelog JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Text-ParserCombinators-ReadPrec.html#t:ReadPrec
Text.ParserCombinators.ReadPrec Source Contents Index base-4.6.0.1: Basic libraries Portability non-portable (uses Text.ParserCombinators.ReadP) Stability provisional Maintainer libraries@haskell.org Safe Haskell Trustworthy Text.ParserCombinators.ReadPrec Contents Precedences Precedence operations Other operations Converters Description This library defines parser combinators for precedence parsing. Synopsis data ReadPrec a type Prec = Int minPrec :: Prec lift :: ReadP a -> ReadPrec a prec :: Prec -> ReadPrec a -> ReadPrec a step :: ReadPrec a -> ReadPrec a reset :: ReadPrec a -> ReadPrec a get :: ReadPrec Char look :: ReadPrec String (+++) :: ReadPrec a -> ReadPrec a -> ReadPrec a (<++) :: ReadPrec a -> ReadPrec a -> ReadPrec a pfail :: ReadPrec a choice :: [ ReadPrec a] -> ReadPrec a readPrec_to_P :: ReadPrec a -> Int -> ReadP a readP_to_Prec :: ( Int -> ReadP a) -> ReadPrec a readPrec_to_S :: ReadPrec a -> Int -> ReadS a readS_to_Prec :: ( Int -> ReadS a) -> ReadPrec a Documentation data ReadPrec a Source Instances Monad ReadPrec   Functor ReadPrec   MonadPlus ReadPrec   Applicative ReadPrec   Alternative ReadPrec   Precedences type Prec = Int Source minPrec :: Prec Source Precedence operations lift :: ReadP a -> ReadPrec a Source Lift a precedence-insensitive ReadP to a ReadPrec . prec :: Prec -> ReadPrec a -> ReadPrec a Source (prec n p) checks whether the precedence context is less than or equal to n , and if not, fails if so, parses p in context n . step :: ReadPrec a -> ReadPrec a Source Increases the precedence context by one. reset :: ReadPrec a -> ReadPrec a Source Resets the precedence context to zero. Other operations All are based directly on their similarly-named ReadP counterparts. get :: ReadPrec Char Source Consumes and returns the next character. Fails if there is no input left. look :: ReadPrec String Source Look-ahead: returns the part of the input that is left, without consuming it. (+++) :: ReadPrec a -> ReadPrec a -> ReadPrec a Source Symmetric choice. (<++) :: ReadPrec a -> ReadPrec a -> ReadPrec a Source Local, exclusive, left-biased choice: If left parser locally produces any result at all, then right parser is not used. pfail :: ReadPrec a Source Always fails. choice :: [ ReadPrec a] -> ReadPrec a Source Combines all parsers in the specified list. Converters readPrec_to_P :: ReadPrec a -> Int -> ReadP a Source readP_to_Prec :: ( Int -> ReadP a) -> ReadPrec a Source readPrec_to_S :: ReadPrec a -> Int -> ReadS a Source readS_to_Prec :: ( Int -> ReadS a) -> ReadPrec a Source Produced by Haddock version 2.13.2
2026-01-13T09:30:24
https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/pg_extended_integer_support_rb.html
pg_extended_integer_support.rb pg_extended_integer_support.rb lib/sequel/extensions/pg_extended_integer_support.rb The pg_extended_integer_support extension supports literalizing Ruby integers outside of PostgreSQL bigint range on PostgreSQL. Sequel by default will raise exceptions when literalizing such integers, as PostgreSQL would treat them as numeric type values instead of integer/bigint type values if unquoted, which can result in unexpected negative performance (e.g. forcing sequential scans when index scans would be used for an integer/bigint type). To load the extension into a Dataset (this returns a new Dataset): dataset = dataset . extension ( :pg_extended_integer_support ) To load the extension into a Database, so it affects all of the Database’s datasets: DB . extension :pg_extended_integer_support By default, the extension will quote integers outside bigint range: DB . literal ( 2 ** 63 ) # => "'9223372036854775808'" Quoting the value treats the type as unknown: DB . get { pg_typeof ( 2 ** 63 )} # => 'unknown' PostgreSQL will implicitly cast the unknown type to the appropriate database type, raising an error if it cannot be casted. Be aware this can result in the integer value being implicitly casted to text or any other PostgreSQL type: # Returns a string, not an integer: DB . get { 2 ** 63 } # => "9223372036854775808" You can use the Dataset#integer_outside_bigint_range_strategy method with the value :raw to change the strategy to not quote the variable: DB . dataset . integer_outside_bigint_range_strategy ( :raw ). literal ( 2 ** 63 ) # => "9223372036854775808" Note that not quoting the value will result in PostgreSQL treating the type as numeric instead of integer: DB . dataset . integer_outside_bigint_range_strategy ( :raw ). get { pg_typeof ( 2 ** 63 )} # => "numeric" The :raw behavior was Sequel’s historical behavior, but unless you fully understand the reprecussions of PostgreSQL using a numeric type for integer values, you should not use it. To get the current default behavior of raising an exception for integers outside of PostgreSQL bigint range, you can use a strategy of :raise . To specify a default strategy for handling integers outside bigint range that applies to all of a Database’s datasets, you can use the :integer_outside_bigint_range_strategy Database option with a value of :raise or :raw : DB . opts [ :integer_outside_bigint_range_strategy ] = :raw The Database option will be used as a fallback if you did not call the Dataset#integer_outside_bigint_range_strategy method to specify a strategy for the dataset. Related module: Sequel::Postgres::ExtendedIntegerSupport Hanna RDoc template
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Functor-Plus.html
src/Data/Functor/Plus.hs {-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} #endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Plus -- Copyright : (C) 2011 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com> -- Stability : provisional -- Portability : portable -- ---------------------------------------------------------------------------- module Data . Functor . Plus ( Plus ( .. ) , module Data . Functor . Alt ) where import Control . Applicative hiding ( some , many ) import Control . Arrow -- import Control.Exception import Control . Monad import Control . Monad . Trans . Identity -- import Control.Monad.Trans.Cont import Control . Monad . Trans . Error import Control . Monad . Trans . List import Control . Monad . Trans . Maybe import Control . Monad . Trans . Reader import qualified Control . Monad . Trans . RWS . Strict as Strict import qualified Control . Monad . Trans . State . Strict as Strict import qualified Control . Monad . Trans . Writer . Strict as Strict import qualified Control . Monad . Trans . RWS . Lazy as Lazy import qualified Control . Monad . Trans . State . Lazy as Lazy import qualified Control . Monad . Trans . Writer . Lazy as Lazy import Data . Functor . Apply import Data . Functor . Alt import Data . Functor . Bind import Data . Semigroup import Prelude hiding ( id , ( . ) ) #ifdef MIN_VERSION_containers import qualified Data . IntMap as IntMap import Data . IntMap ( IntMap ) import Data . Sequence ( Seq ) import qualified Data . Map as Map import Data . Map ( Map ) #endif -- | Laws: -- -- > zero <!> m = m -- > m <!> zero = m -- -- If extended to an 'Alternative' then 'zero' should equal 'empty'. class Alt f => Plus f where zero :: f a instance Plus IO where zero = error "zero" instance Plus [] where zero = [] instance Plus Maybe where zero = Nothing instance Plus Option where zero = empty instance MonadPlus m => Plus ( WrappedMonad m ) where zero = empty instance ArrowPlus a => Plus ( WrappedArrow a b ) where zero = empty #ifdef MIN_VERSION_containers instance Ord k => Plus ( Map k ) where zero = Map . empty instance Plus IntMap where zero = IntMap . empty instance Plus Seq where zero = mempty #endif instance Alternative f => Plus ( WrappedApplicative f ) where zero = empty instance Plus f => Plus ( IdentityT f ) where zero = IdentityT zero instance Plus f => Plus ( ReaderT e f ) where zero = ReaderT $ \ _ -> zero instance ( Bind f , Monad f ) => Plus ( MaybeT f ) where zero = MaybeT $ return zero instance ( Bind f , Monad f , Error e ) => Plus ( ErrorT e f ) where zero = ErrorT $ return $ Left noMsg instance ( Apply f , Applicative f ) => Plus ( ListT f ) where zero = ListT $ pure [] instance ( Plus f ) => Plus ( Strict . StateT e f ) where zero = Strict . StateT $ \ _ -> zero instance ( Plus f ) => Plus ( Lazy . StateT e f ) where zero = Lazy . StateT $ \ _ -> zero instance Plus f => Plus ( Strict . WriterT w f ) where zero = Strict . WriterT zero instance Plus f => Plus ( Lazy . WriterT w f ) where zero = Lazy . WriterT zero instance Plus f => Plus ( Strict . RWST r w s f ) where zero = Strict . RWST $ \ _ _ -> zero instance Plus f => Plus ( Lazy . RWST r w s f ) where zero = Lazy . RWST $ \ _ _ -> zero
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Functor-Plus.html#zero
src/Data/Functor/Plus.hs {-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} #endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Plus -- Copyright : (C) 2011 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com> -- Stability : provisional -- Portability : portable -- ---------------------------------------------------------------------------- module Data . Functor . Plus ( Plus ( .. ) , module Data . Functor . Alt ) where import Control . Applicative hiding ( some , many ) import Control . Arrow -- import Control.Exception import Control . Monad import Control . Monad . Trans . Identity -- import Control.Monad.Trans.Cont import Control . Monad . Trans . Error import Control . Monad . Trans . List import Control . Monad . Trans . Maybe import Control . Monad . Trans . Reader import qualified Control . Monad . Trans . RWS . Strict as Strict import qualified Control . Monad . Trans . State . Strict as Strict import qualified Control . Monad . Trans . Writer . Strict as Strict import qualified Control . Monad . Trans . RWS . Lazy as Lazy import qualified Control . Monad . Trans . State . Lazy as Lazy import qualified Control . Monad . Trans . Writer . Lazy as Lazy import Data . Functor . Apply import Data . Functor . Alt import Data . Functor . Bind import Data . Semigroup import Prelude hiding ( id , ( . ) ) #ifdef MIN_VERSION_containers import qualified Data . IntMap as IntMap import Data . IntMap ( IntMap ) import Data . Sequence ( Seq ) import qualified Data . Map as Map import Data . Map ( Map ) #endif -- | Laws: -- -- > zero <!> m = m -- > m <!> zero = m -- -- If extended to an 'Alternative' then 'zero' should equal 'empty'. class Alt f => Plus f where zero :: f a instance Plus IO where zero = error "zero" instance Plus [] where zero = [] instance Plus Maybe where zero = Nothing instance Plus Option where zero = empty instance MonadPlus m => Plus ( WrappedMonad m ) where zero = empty instance ArrowPlus a => Plus ( WrappedArrow a b ) where zero = empty #ifdef MIN_VERSION_containers instance Ord k => Plus ( Map k ) where zero = Map . empty instance Plus IntMap where zero = IntMap . empty instance Plus Seq where zero = mempty #endif instance Alternative f => Plus ( WrappedApplicative f ) where zero = empty instance Plus f => Plus ( IdentityT f ) where zero = IdentityT zero instance Plus f => Plus ( ReaderT e f ) where zero = ReaderT $ \ _ -> zero instance ( Bind f , Monad f ) => Plus ( MaybeT f ) where zero = MaybeT $ return zero instance ( Bind f , Monad f , Error e ) => Plus ( ErrorT e f ) where zero = ErrorT $ return $ Left noMsg instance ( Apply f , Applicative f ) => Plus ( ListT f ) where zero = ListT $ pure [] instance ( Plus f ) => Plus ( Strict . StateT e f ) where zero = Strict . StateT $ \ _ -> zero instance ( Plus f ) => Plus ( Lazy . StateT e f ) where zero = Lazy . StateT $ \ _ -> zero instance Plus f => Plus ( Strict . WriterT w f ) where zero = Strict . WriterT zero instance Plus f => Plus ( Lazy . WriterT w f ) where zero = Lazy . WriterT zero instance Plus f => Plus ( Strict . RWST r w s f ) where zero = Strict . RWST $ \ _ _ -> zero instance Plus f => Plus ( Lazy . RWST r w s f ) where zero = Lazy . RWST $ \ _ _ -> zero
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Functor-Plus.html#Plus
src/Data/Functor/Plus.hs {-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} #endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Plus -- Copyright : (C) 2011 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com> -- Stability : provisional -- Portability : portable -- ---------------------------------------------------------------------------- module Data . Functor . Plus ( Plus ( .. ) , module Data . Functor . Alt ) where import Control . Applicative hiding ( some , many ) import Control . Arrow -- import Control.Exception import Control . Monad import Control . Monad . Trans . Identity -- import Control.Monad.Trans.Cont import Control . Monad . Trans . Error import Control . Monad . Trans . List import Control . Monad . Trans . Maybe import Control . Monad . Trans . Reader import qualified Control . Monad . Trans . RWS . Strict as Strict import qualified Control . Monad . Trans . State . Strict as Strict import qualified Control . Monad . Trans . Writer . Strict as Strict import qualified Control . Monad . Trans . RWS . Lazy as Lazy import qualified Control . Monad . Trans . State . Lazy as Lazy import qualified Control . Monad . Trans . Writer . Lazy as Lazy import Data . Functor . Apply import Data . Functor . Alt import Data . Functor . Bind import Data . Semigroup import Prelude hiding ( id , ( . ) ) #ifdef MIN_VERSION_containers import qualified Data . IntMap as IntMap import Data . IntMap ( IntMap ) import Data . Sequence ( Seq ) import qualified Data . Map as Map import Data . Map ( Map ) #endif -- | Laws: -- -- > zero <!> m = m -- > m <!> zero = m -- -- If extended to an 'Alternative' then 'zero' should equal 'empty'. class Alt f => Plus f where zero :: f a instance Plus IO where zero = error "zero" instance Plus [] where zero = [] instance Plus Maybe where zero = Nothing instance Plus Option where zero = empty instance MonadPlus m => Plus ( WrappedMonad m ) where zero = empty instance ArrowPlus a => Plus ( WrappedArrow a b ) where zero = empty #ifdef MIN_VERSION_containers instance Ord k => Plus ( Map k ) where zero = Map . empty instance Plus IntMap where zero = IntMap . empty instance Plus Seq where zero = mempty #endif instance Alternative f => Plus ( WrappedApplicative f ) where zero = empty instance Plus f => Plus ( IdentityT f ) where zero = IdentityT zero instance Plus f => Plus ( ReaderT e f ) where zero = ReaderT $ \ _ -> zero instance ( Bind f , Monad f ) => Plus ( MaybeT f ) where zero = MaybeT $ return zero instance ( Bind f , Monad f , Error e ) => Plus ( ErrorT e f ) where zero = ErrorT $ return $ Left noMsg instance ( Apply f , Applicative f ) => Plus ( ListT f ) where zero = ListT $ pure [] instance ( Plus f ) => Plus ( Strict . StateT e f ) where zero = Strict . StateT $ \ _ -> zero instance ( Plus f ) => Plus ( Lazy . StateT e f ) where zero = Lazy . StateT $ \ _ -> zero instance Plus f => Plus ( Strict . WriterT w f ) where zero = Strict . WriterT zero instance Plus f => Plus ( Lazy . WriterT w f ) where zero = Lazy . WriterT zero instance Plus f => Plus ( Strict . RWST r w s f ) where zero = Strict . RWST $ \ _ _ -> zero instance Plus f => Plus ( Lazy . RWST r w s f ) where zero = Lazy . RWST $ \ _ _ -> zero
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Functor-Bind-Trans.html
src/Data/Functor/Bind/Trans.hs {-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Bind.Trans -- Copyright : (C) 2011 Edward Kmett, -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com> -- Stability : provisional -- Portability : portable -- ---------------------------------------------------------------------------- module Data . Functor . Bind . Trans ( BindTrans ( .. ) ) where -- import _everything_ import Control . Category #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 707 import Control . Monad . Instances () #endif import Control . Monad . Trans . Class import Control . Monad . Trans . Cont -- import Control.Monad.Trans.Error import Control . Monad . Trans . Identity -- import Control.Monad.Trans.Maybe import Control . Monad . Trans . Reader -- import Control.Monad.Trans.List import qualified Control . Monad . Trans . RWS . Lazy as Lazy import qualified Control . Monad . Trans . State . Lazy as Lazy import qualified Control . Monad . Trans . Writer . Lazy as Lazy import qualified Control . Monad . Trans . RWS . Strict as Strict import qualified Control . Monad . Trans . State . Strict as Strict import qualified Control . Monad . Trans . Writer . Strict as Strict import Data . Functor . Bind import Data . Semigroup hiding ( Product ) import Prelude hiding ( id , ( . ) ) -- | A subset of monad transformers can transform any 'Bind' as well. class MonadTrans t => BindTrans t where liftB :: Bind b => b a -> t b a instance BindTrans IdentityT where liftB = IdentityT instance BindTrans ( ReaderT e ) where liftB = ReaderT . const instance ( Semigroup w , Monoid w ) => BindTrans ( Lazy . WriterT w ) where liftB = Lazy . WriterT . fmap ( \ a -> ( a , mempty ) ) instance ( Semigroup w , Monoid w ) => BindTrans ( Strict . WriterT w ) where liftB = Strict . WriterT . fmap ( \ a -> ( a , mempty ) ) instance BindTrans ( Lazy . StateT s ) where liftB m = Lazy . StateT $ \ s -> fmap ( \ a -> ( a , s ) ) m instance BindTrans ( Strict . StateT s ) where liftB m = Strict . StateT $ \ s -> fmap ( \ a -> ( a , s ) ) m instance ( Semigroup w , Monoid w ) => BindTrans ( Lazy . RWST r w s ) where liftB m = Lazy . RWST $ \ _r s -> fmap ( \ a -> ( a , s , mempty ) ) m instance ( Semigroup w , Monoid w ) => BindTrans ( Strict . RWST r w s ) where liftB m = Strict . RWST $ \ _r s -> fmap ( \ a -> ( a , s , mempty ) ) m instance BindTrans ( ContT r ) where liftB m = ContT ( m >>- )
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#silent-ignoring-safe-parameters
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#understanding-the-architecture
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://www.facebook.com/login/?next=https%3A%2F%2Fl.facebook.com%2Fl.php%3Fu%3Dhttps%253A%252F%252Fwww.instagram.com%252F%26amp%253Bh%3DAT1rTj7dP8HEVZ652WWfXcMFsvmZTLQnrED-M8OlfMCsFd_McQvIfUTCkvOh-4L7EjD6blww805sIdLlfHWloAzKhIYTpWDh0sLe-j4SubBoRMXLLRrKQu4VGrcT-LGzzSfFczE3mXTnsu2a
Facebook Facebook 이메일 또는 휴대폰 비밀번호 계정을 잊으셨나요? 새 계정 만들기 일시적으로 차단됨 일시적으로 차단됨 회원님의 이 기능 사용 속도가 너무 빠른 것 같습니다. 이 기능 사용에서 일시적으로 차단되었습니다. Back 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch 가입하기 로그인 Messenger Facebook Lite 동영상 Meta Pay Meta 스토어 Meta Quest Ray-Ban Meta Meta AI Meta AI 콘텐츠 더 보기 Instagram Threads 투표 정보 센터 개인정보처리방침 개인정보 보호 센터 정보 광고 만들기 페이지 만들기 개발자 채용 정보 쿠키 AdChoices 이용 약관 고객 센터 연락처 업로드 및 비사용자 설정 활동 로그 Meta © 2026
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#api-overview
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#openai-sdk-compatible-api
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_openai_chat_completions/
Chat Completions - stdapi.ai Skip to content stdapi.ai Chat Completions Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible OpenAI Compatible Chat Completions Chat Completions Table of contents Why Choose Chat Completions? Quick Start: Available Endpoint Feature Compatibility Advanced Features Prompt Caching S3 Image Support Available Request Headers Content Safety (Guardrails) Performance Optimization AWS Bedrock System Tools Amazon Nova Web Grounding Provider-Specific Parameters Anthropic Claude Features Beta Feature Flags Reasoning Control DeepSeek Reasoning Support Try It Now Images Generations Images Edits Images Variations Audio Speech Audio Transcriptions Audio Translations Embeddings Models Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Why Choose Chat Completions? Quick Start: Available Endpoint Feature Compatibility Advanced Features Prompt Caching S3 Image Support Available Request Headers Content Safety (Guardrails) Performance Optimization AWS Bedrock System Tools Amazon Nova Web Grounding Provider-Specific Parameters Anthropic Claude Features Beta Feature Flags Reasoning Control DeepSeek Reasoning Support Try It Now Home Documentation API OpenAI Compatible Chat Completions API ¶ This OpenAI-compatible endpoint provides access to AWS Bedrock foundation models—including Claude, Nova, and more—through a familiar interface. Why Choose Chat Completions? ¶ Multiple Models Access models from Anthropic, Amazon, Meta, and more through one API. Choose the best model for your task without vendor lock-in. Multi-Modal Process text, images, videos, and documents together. Support for URLs, data URIs, and direct S3 references. Built-In Safety AWS Bedrock Guardrails provide content filtering and safety policies. AWS Scale & Reliability Run on AWS infrastructure with service tiers for optimized latency. Multi-region model access for availability and performance. Quick Start: Available Endpoint ¶ Endpoint Method What It Does Powered By /v1/chat/completions POST Conversational AI with multi-modal support AWS Bedrock Converse API Feature Compatibility ¶ Feature Status Notes Messages & Roles Text messages Full support for all text content Image input ( image_url ) HTTP, data URIs Image input from S3 S3 URLs Video input Supported by select models Audio input Unsupported Document input ( file ) PDF and document support varies by model System messages Includes developer role Tool Calling Function calling ( tools ) Full OpenAI-compatible schema Legacy function_call Backward compatibility maintained Parallel tool calls Multiple tools in one turn Disable Parallel tool calls Parallel tool calls are always on Non-function tool types Only function tools supported System tools ( systemTool_* ) AWS Bedrock system tools (e.g., web grounding with citations) Generation Control max_tokens / max_completion_tokens Output length limits temperature Mapped to Bedrock inference params top_p Nucleus sampling control stop sequences Custom stop strings frequency_penalty / presence_penalty Repetition control seed Deterministic generation logit_bias Not all models support biasing top_logprobs Token probability output top_k (From Qwen API) Candidate token set size for sampling reasoning_effort Reasoning control (minimal/low/medium/high) enable_thinking (From Qwen API) Enable thinking mode thinking_budget (From Qwen API) Thinking token budget n (multiple choices) Generate multiple responses, not supported with streaming logprobs Log probabilities prediction Static predicted output content response_format Response format specification verbosity Model verbosity web_search_options Web search tool prompt_cache_key Cache prompts to reduce costs and latency Extra model-specific params Extra model-specific parameters not supported by the OpenAI API Streaming & Output Text Text messages Streaming ( stream: true ) Server-Sent Events (SSE) Streaming obfuscation Unsupported Audio Synthesis from text output response_format (JSON mode) Model-specific JSON support reasoning_content (From Deepseek API) Text reasoning messages annotations (URL citations) URL citations from system tools (non-streaming only) Usage tracking Input text tokens Billing unit Output tokens Billing unit Reasoning tokens Estimated Other Service tiers Mapped to Bedrock service tiers and latency options store / metadata OpenAI-specific features safety_identifier / user Logged Bedrock Guardrails Content safety policies Legend: Supported — Fully compatible with OpenAI API Available on Select Models — Check your model's capabilities Partial — Supported with limitations Unsupported — Not available in this implementation Extra Feature — Enhanced capability beyond OpenAI API Advanced Features ¶ Prompt Caching ¶ Reduce costs and improve response times by caching frequently-used prompt components across multiple requests. This feature is particularly effective for applications with consistent system prompts, tool definitions, or conversation contexts. Supported Models: Anthropic Claude : Full support for system, messages, and tools caching Amazon Nova : Support for system and messages caching Documentation See AWS Bedrock Prompt Caching - Supported Models for the complete list of models supporting prompt caching. Cache Creation Costs Cache creation incurs a higher cost than regular token processing. Only use prompt caching when you expect a high cache hit ratio across multiple requests with similar prompts. How to Use: Set the prompt_cache_key parameter to enable caching: curl -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic.claude-sonnet-4-5-20250929-v1:0", "prompt_cache_key": "default", "messages": [ { "role": "system", "content": "You are a helpful assistant with extensive knowledge..." }, {"role": "user", "content": "What is 2 + 2?"} ] }' Granular Cache Control: Enable caching for specific prompt sections using dot-separated values: "system" - Cache system messages only "messages" - Cache conversation history "tools" - Cache tool/function definitions (Anthropic Claude only) "system.messages" - Cache both system and messages "system.tools" - Cache system and tools "messages.tools" - Cache messages and tools "system.messages.tools" - Cache all components Any other non-empty value - Cache all components Custom Cache Keys Not Supported Custom cache hash keys are not supported. The parameter is used only to control which sections are cached, not as a cache identifier. { "model" : "anthropic.claude-sonnet-4-5-20250929-v1:0" , "prompt_cache_key" : "system.tools" , "messages" : [ ... ], "tools" : [ ... ] } Benefits: Cost Reduction : Cached tokens are billed at a lower rate than regular input tokens Lower Latency : Cached prompts eliminate reprocessing time Automatic Management : The API handles cache invalidation and updates Usage Tracking: Cached token usage is reported in the response: { "usage" : { "prompt_tokens" : 1500 , "completion_tokens" : 100 , "total_tokens" : 1600 , "prompt_tokens_details" : { "cached_tokens" : 1200 } } } In this example, 1,200 tokens were retrieved from cache, with only 300 tokens requiring processing. S3 Image Support ¶ Access images directly from your S3 buckets without generating pre-signed URLs or downloading files locally. Supported Formats: Images : JPEG, PNG, GIF, WebP How to Use: Simply reference your S3 images using the s3:// URI scheme in image_url fields: { "model" : "anthropic.claude-sonnet-4-5-20250929-v1:0" , "messages" : [ { "role" : "user" , "content" : [ { "type" : "text" , "text" : "Describe this image" }, { "type" : "image_url" , "image_url" : { "url" : "s3://my-bucket/images/photo.jpg" } } ] } ] } IAM Permissions Required Your API service must have IAM permissions to read from the specified S3 buckets. S3 objects must be in the same AWS region as the executed model or accessible via your IAM role. Standard S3 data transfer and request costs apply. Benefits: No pre-signed URLs - Direct S3 access without generating temporary URLs Security - Images stay in your AWS account with IAM-controlled access Performance - Optimized data transfer within AWS infrastructure Large images - No size limitations of data URIs or base64 encoding Available Request Headers ¶ This endpoint supports standard Bedrock headers for enhanced control over your requests. All headers are optional and can be combined as needed. Content Safety (Guardrails) ¶ Header Purpose Valid Values X-Amzn-Bedrock-GuardrailIdentifier Guardrail ID for content filtering Your guardrail identifier X-Amzn-Bedrock-GuardrailVersion Guardrail version Version number (e.g., 1 ) X-Amzn-Bedrock-Trace Guardrail trace level disabled , enabled , enabled_full Performance Optimization ¶ Header Purpose Valid Values X-Amzn-Bedrock-Service-Tier Service tier selection priority , default , flex X-Amzn-Bedrock-PerformanceConfig-Latency Latency optimization standard , optimized Example with all headers: curl -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -H "X-Amzn-Bedrock-GuardrailIdentifier: your-guardrail-id" \ -H "X-Amzn-Bedrock-GuardrailVersion: 1" \ -H "X-Amzn-Bedrock-Trace: enabled" \ -H "X-Amzn-Bedrock-Service-Tier: priority" \ -H "X-Amzn-Bedrock-PerformanceConfig-Latency: optimized" \ -d '{ "model": "anthropic.claude-sonnet-4-5-20250929-v1:0", "messages": [{"role": "user", "content": "Hello!"}] }' Detailed Documentation For complete information about these headers, configuration options, and use cases, see: Bedrock Guardrails Configuration Service Tier and Performance Configuration AWS Bedrock System Tools ¶ AWS Bedrock system tools are built-in capabilities that foundation models can use directly without requiring you to implement backend integrations. Access any AWS Bedrock system tool by adding the systemTool_ prefix to its name—this works for current tools and any future system tools AWS releases. How to Use: Add system tools to your tools array using the systemTool_ prefix followed by the tool name. System tools don't require parameter definitions—just specify the tool name and the model will handle the rest. As AWS releases new system tools, simply use the same systemTool_ prefix pattern to access them. Amazon Nova Web Grounding ¶ Amazon Nova Web Grounding enables models to search the web for current information, helping answer questions requiring real-time data like news, weather, product availability, or recent events. The model automatically determines when to use web grounding based on the user's query. Learn More Amazon Nova Web Grounding - User Guide Build More Accurate AI Applications with Amazon Nova Web Grounding - Blog Post Usage: curl -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-premier-v1:0", "messages": [ { "role": "user", "content": "What are the current AWS Regions and their locations?" } ], "tools": [ { "type": "function", "function": { "name": "systemTool_nova_grounding" } } ] }' Response Format: When using web grounding, the API response includes annotations with URL citations in non-streaming mode: { "choices" : [{ "message" : { "role" : "assistant" , "content" : "The AWS Regions include..." , "annotations" : [ { "type" : "url_citation" , "url_citation" : { "url" : "https://aws.amazon.com/about-aws/global-infrastructure/" , "title" : "AWS Global Infrastructure" } } ] } }] } Streaming Mode Citations are only available in non-streaming responses. The OpenAI API does not support annotations in streaming mode. Use Cases: Current Events : Get up-to-date information about news, weather, stock prices, or sports scores Dynamic Data : Query information that changes frequently like AWS service availability or product prices Verification : Cross-reference facts with current web sources for improved accuracy Knowledge Extension : Supplement model training data with real-time information Benefits: Zero Integration : No need to implement or maintain web search APIs Automatic Invocation : Models intelligently decide when to use web grounding Enhanced Accuracy : Reduce hallucinations with real-time information retrieval OpenAI-Compatible : Works seamlessly with standard tool calling patterns Model and Region Compatibility Model : Only Amazon Nova Premier ( amazon.nova-premier-v1:0 ) supports the systemTool_nova_grounding tool. Region : Web Grounding is only available in US regions. Provider-Specific Parameters ¶ Unlock advanced model capabilities by passing provider-specific parameters directly in your requests. These parameters are forwarded to AWS Bedrock and allow you to access features unique to each foundation model provider. Documentation See Bedrock Model Parameters for the complete list of available parameters per model. How It Works: Add provider-specific fields at the top level of your request body alongside standard OpenAI parameters. The API automatically forwards these to the appropriate model provider via AWS Bedrock. Examples: Top K Sampling: { "model" : "anthropic.claude-sonnet-4-5-20250929-v1:0"", " messages ": [{" role ": " user ", " co ntent ": " Wri te a poem "}], " t op_k ": 50, " te mpera ture ": 0.7 } Configuration Options: Option 1: Per-Request Add provider-specific parameters directly in your request body (as shown in examples above). Option 2: Server-Wide Defaults Configure default parameters for specific models via the DEFAULT_MODEL_PARAMS environment variable: export DEFAULT_MODEL_PARAMS = '{ "anthropic.claude-sonnet-4-5-20250929-v1:0": { "anthropic_beta": ["extended-thinking-2024-12-12"] } }' Parameter Priority Per-request parameters override server-wide defaults. Behavior: ✅ Compatible parameters : Forwarded to the model and applied ⚠️ Unsupported parameters : Return HTTP 400 with an error message Anthropic Claude Features ¶ Enable cutting-edge Claude capabilities including extended thinking and reasoning. Beta Feature Flags ¶ Enable experimental Claude features like extended thinking by adding the anthropic_beta array to your request: curl -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic.claude-sonnet-4-5-20250929-v1:0", "messages": [{"role":"user","content":"Summarize the news headline."}], "anthropic_beta": ["Interleaved-thinking-2025-05-14"] }' Server-Wide Configuration You can also configure beta flags server-wide using the DEFAULT_MODEL_PARAMS environment variable (see Provider-Specific Parameters ). Unsupported Beta Flags Unsupported flags that would change output return HTTP 400 errors. Documentation See Using Claude on AWS Bedrock for more details on Claude-specific parameters. Reasoning Control ¶ This API supports two different approaches to control AWS Bedrock reasoning behavior. Reasoning enables foundation models to break down complex tasks into smaller steps ("chain of thought"), improving accuracy for multi-step analysis, math problems, and complex reasoning tasks. Both approaches work with all AWS Bedrock models that support reasoning capabilities. Option 1: OpenAI-Style Reasoning ( reasoning_effort ) Use the reasoning_effort parameter with predefined effort levels. This approach works with all AWS Bedrock models that support reasoning, providing a simple way to control reasoning depth. Available Levels: minimal - Quick responses with minimal reasoning (25% of max tokens) low - Light reasoning for straightforward tasks (50% of max tokens) medium - Balanced reasoning for most use cases (75% of max tokens) high - Deep reasoning for complex problems (100% of max tokens) Example: curl -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic.claude-sonnet-4-5-20250929-v1:0", "reasoning_effort": "high", "messages": [{"role": "user", "content": "Solve this complex problem..."}] }' Option 2: Qwen-Style Reasoning ( enable_thinking + thinking_budget ) Use explicit parameters for fine-grained control over thinking mode. This approach works with all AWS Bedrock models that support reasoning, offering precise control over reasoning behavior and token budgets. Parameters: enable_thinking (boolean): Enable or disable thinking mode Default: Model-specific (usually false ) Some models have reasoning always enabled thinking_budget (integer): Maximum thinking process length in tokens Only effective when enable_thinking is true Passed to the model as budget_tokens Default: Model's maximum chain-of-thought length Example: curl -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic.claude-sonnet-4-5-20250929-v1:0", "enable_thinking": true, "thinking_budget": 2000, "messages": [{"role": "user", "content": "Solve this complex problem..."}] }' Using Python SDK: from openai import OpenAI client = OpenAI ( api_key = "your-api-key" , base_url = "https://your-endpoint/v1" ) # OpenAI-style reasoning (predefined effort levels) response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , reasoning_effort = "high" , messages = [{ "role" : "user" , "content" : "Complex problem..." }] ) # Qwen-style reasoning (fine-grained control) response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Complex problem..." }], extra_body = { "enable_thinking" : True , "thinking_budget" : 2000 } ) Reasoning Output Models that support reasoning will include their thinking process in reasoning_content fields in the response. DeepSeek Reasoning Support ¶ DeepSeek models with reasoning capabilities are automatically handled—their chain-of-thought reasoning appears in reasoning_content fields without any special configuration, just like DeepSeek's native chat completions endpoint. Documentation See DeepSeek API - Chat Completions for more information about DeepSeek's reasoning capabilities. What You Get: Automatic reasoning : DeepSeek reasoning models automatically include their thinking process reasoning_content field : Receive visible reasoning text in assistant messages Streaming support : Get choices[].delta.reasoning_content chunks in real-time as the model thinks Compatible format : Uses the same DeepSeek-compatible response format How It Works: When using DeepSeek reasoning models, the API automatically surfaces their chain-of-thought Non-reasoning models simply omit the reasoning_content field No special parameters needed—just use the model and reasoning appears automatically Try It Now ¶ Basic chat completion: curl -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [{"role": "user", "content": "Say hello world"}] }' Streaming response: curl -N -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "stream": true, "messages": [{"role": "user", "content": "Write a haiku about the sea."}] }' Multi-modal with image: { "model" : "amazon.nova-micro-v1:0" , "messages" : [ { "role" : "user" , "content" : [ { "type" : "text" , "text" : "Describe this image" }, { "type" : "image_url" , "image_url" : { "url" : "https://example.com/photo.jpg" }} ] } ] } With reasoning: curl -X POST " $BASE /v1/chat/completions" \ -H "Authorization: Bearer $OPENAI_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model": "anthropic.claude-sonnet-4-5-20250929-v1:0", "reasoning_effort": "low", "messages": [{"role": "user", "content": "Solve 12*13"}] }' Response with reasoning: { "choices" : [{ "message" : { "role" : "assistant" , "reasoning_content" : "12 × 10 = 120, plus 12 × 3 = 36 → 156" , "content" : "156" } }] } Ready to build with AI? Check out the Models API to see all available foundation models! Back to top Previous Overview Next Images Generations JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#understanding-compatibility
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/use_cases/
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview Overview Table of contents Why Use stdapi.ai? Choose Your Integration 💬 Chat Interfaces 🔄 Workflow Automation 💻 Developer Tools 📝 Knowledge Management 🤖 Chatbots & Assistants 🤖 Autonomous Agents 🚀 Quick Start Guide 📊 Model Selection Guide 💡 Integration Benefits 🔒 Privacy & Security 💰 Cost Control 🎯 Superior Models 🚀 No Rate Limits 🎯 Common Use Case Combinations 🆚 Comparison: OpenAI vs stdapi.ai 🚀 Get Started Today 🤝 Community & Support 🎓 Additional Resources Learn More Explore Integrations OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Why Use stdapi.ai? Choose Your Integration 💬 Chat Interfaces 🔄 Workflow Automation 💻 Developer Tools 📝 Knowledge Management 🤖 Chatbots & Assistants 🤖 Autonomous Agents 🚀 Quick Start Guide 📊 Model Selection Guide 💡 Integration Benefits 🔒 Privacy & Security 💰 Cost Control 🎯 Superior Models 🚀 No Rate Limits 🎯 Common Use Case Combinations 🆚 Comparison: OpenAI vs stdapi.ai 🚀 Get Started Today 🤝 Community & Support 🎓 Additional Resources Learn More Explore Integrations Home Documentation Use cases Use Cases ¶ Discover how to integrate stdapi.ai with popular AI applications and tools. stdapi.ai's OpenAI-compatible API makes it a drop-in replacement for OpenAI in hundreds of applications, giving you access to Amazon Bedrock models with zero code changes. Why Use stdapi.ai? ¶ OpenAI Compatibility, Bedrock Power Any application, tool, or framework designed for OpenAI's API works seamlessly with stdapi.ai. Simply change the API endpoint and key—that's it. You immediately gain access to: Anthropic Claude Models — Superior reasoning, coding, and conversation Amazon Nova Family — Cost-effective models for every use case Enterprise Privacy — Your data stays in your AWS environment Cost Control — AWS pricing with no surprise bills No Rate Limits — Scale without OpenAI's restrictive quotas Full Control — Self-hosted infrastructure you own and manage Choose Your Integration ¶ Select the category that matches your needs, or explore multiple integrations to use Amazon Bedrock across your workflow. 💬 Chat Interfaces ¶ Build ChatGPT-like experiences with enterprise models and full privacy control. Featured Integrations OpenWebUI Integration Transform OpenWebUI into your private ChatGPT alternative with Amazon Bedrock models. Perfect for teams wanting a familiar chat interface with enterprise security. ✅ 40,000+ GitHub stars — Most popular open-source AI web UI ✅ Multi-modal — Chat, voice, images, and document RAG ✅ Self-hosted — Complete control over your AI assistant ✅ Easy setup — Configure with environment variables LibreChat Integration Deploy a feature-rich team collaboration platform with multi-user support, conversation management, and advanced customization. ✅ 30,000+ GitHub stars — Production-ready ChatGPT alternative ✅ Multi-user — Individual accounts and team collaboration ✅ Extensible — Plugin system and custom configurations ✅ Enterprise features — SSO, quotas, and audit logs 🔄 Workflow Automation ¶ Integrate AI into your business processes and automation workflows. Featured Integration N8N Integration Build powerful AI-enhanced workflows with N8N's visual automation platform. Connect AI to 400+ services and APIs. ✅ 45,000+ GitHub stars — Leading workflow automation tool ✅ 400+ integrations — Connect with any service or API ✅ Visual builder — No-code workflow creation ✅ Template compatible — Use any OpenAI N8N template Use Cases: - Customer support automation - Content generation pipelines - Data analysis and enrichment - Voice processing workflows - Image generation automation 💻 Developer Tools ¶ Enhance your development workflow with AI-powered coding assistants. Featured Integration IDE Integration — Continue.dev & Others Get AI assistance directly in VS Code, JetBrains IDEs, Cursor, and more. Code faster with intelligent completions and chat. ✅ Multiple IDEs — VS Code, JetBrains, Cursor, Zed, Windsurf ✅ Multiple tools — Continue.dev, Cline, Twinny, JetBrains AI Assistant ✅ Real-time completions — AI-powered code suggestions as you type ✅ Codebase understanding — Chat with your entire project LangChain / LlamaIndex Integration Build production AI applications with the most popular frameworks. Keep your code, just change the endpoint. ✅ 90,000+ stars (LangChain) — Industry-standard AI framework ✅ 35,000+ stars (LlamaIndex) — Leading data indexing framework ✅ Zero code changes — Drop-in OpenAI replacement ✅ All features supported — Chains, agents, RAG, and more 📝 Knowledge Management ¶ Enhance your notes and documents with AI-powered insights and generation. Featured Integration Note-Taking Apps — Obsidian & Notion Transform your knowledge base with AI writing assistance, semantic search, and intelligent linking. ✅ Obsidian plugins — Text Generator, Smart Connections, Copilot ✅ Notion integration — API scripts and automation workflows ✅ Semantic search — Find notes by meaning, not just keywords ✅ Writing enhancement — AI-powered editing and generation Use Cases: - Writing assistance and editing - Automatic summarization - Semantic note discovery - Content structuring - Knowledge extraction 🤖 Chatbots & Assistants ¶ Deploy AI assistants to your team's communication platforms. Featured Integration Chat Bots — Slack, Discord & Teams Build intelligent bots for your team's favorite platforms with enterprise models and full conversation context. ✅ Multiple platforms — Slack, Discord, Microsoft Teams, Telegram ✅ Full code examples — Python and JavaScript implementations ✅ Conversation memory — Context-aware multi-turn discussions ✅ Custom commands — Slash commands and bot interactions Use Cases: - Team Q&A assistants - Customer support bots - Internal knowledge bots - Workflow automation - Daily summaries and reports 🤖 Autonomous Agents ¶ Build self-directed AI agents that can plan, execute, and refine complex tasks. Featured Integration Autonomous Agents — AutoGPT & More Deploy autonomous agents powered by Amazon Bedrock for research, automation, and complex problem-solving. ✅ AutoGPT — Most popular autonomous agent framework ✅ BabyAGI — Minimal, focused task execution ✅ CrewAI — Multi-agent team collaboration ✅ LangGraph — Stateful agent workflows Use Cases: - Research and analysis - Content creation pipelines - Automated testing - Data processing - Code generation 🚀 Quick Start Guide ¶ Getting started with any integration is simple and follows the same pattern: Universal Configuration Pattern Step 1: Install or deploy your chosen application Step 2: Configure the OpenAI-compatible settings: API Base URL : https://YOUR_STDAPI_SERVER/v1 API Key : your_stdapi_key_here Model : anthropic.claude-sonnet-4-5-20250929-v1:0 Step 3: Start using Amazon Bedrock models! That's it—no code changes, no complex migration, just change the endpoint and you're done. 📊 Model Selection Guide ¶ Different use cases benefit from different models. Here's a quick reference: Use Case Example Model Why Complex reasoning & coding Claude Sonnet (latest) Superior intelligence and context understanding General chat & assistance Amazon Nova Lite Balanced performance and cost High-volume operations Amazon Nova Micro Fast, cost-effective at scale Long documents Amazon Nova Pro Large context window support Embeddings & RAG Amazon Titan Embeddings Optimized for semantic search Voice synthesis Amazon Polly (Neural/Generative) Natural-sounding speech Voice recognition Amazon Transcribe Accurate multi-language transcription Image generation Amazon Nova Canvas High-quality image creation All Models Available These are popular starting points, but all Amazon Bedrock models are accessible through stdapi.ai. Choose based on your specific requirements for quality, speed, cost, and features. 💡 Integration Benefits ¶ 🔒 Privacy & Security ¶ Your data never leaves your infrastructure. Unlike OpenAI's cloud service, stdapi.ai keeps all conversations, documents, and generated content within your AWS environment. Perfect for: Healthcare (HIPAA compliance) Finance (regulatory requirements) Enterprise (data sovereignty) Government (security clearances) 💰 Cost Control ¶ Transparent, predictable pricing. Pay only for what you use with AWS pricing—no surprise bills, no rate limit fees, no mandatory upgrades: Pay-per-token AWS rates No monthly subscriptions No rate limit charges Volume discounts available Budget alerts and controls 🎯 Superior Models ¶ Access state-of-the-art models optimized for different tasks. Amazon Bedrock provides cutting-edge AI models from leading providers: Anthropic Claude — Industry-leading reasoning, coding, and long-form content generation Amazon Nova Family — Purpose-built models at various price points Specialized models — Task-optimized options for embeddings, voice, and images 🚀 No Rate Limits ¶ Scale without restrictions. OpenAI imposes strict rate limits that can block your applications. With stdapi.ai on your own infrastructure: Process unlimited requests No throttling during peak usage Scale to your needs No waiting for rate limit increases 🎯 Common Use Case Combinations ¶ Many users deploy multiple integrations together for a complete AI solution: Team Productivity Suite Combination: OpenWebUI + Slack Bot + IDE Integration Result: Team members use OpenWebUI for research and writing, a Slack bot for quick questions, and Continue.dev for coding—all powered by the same Bedrock models. Content Creation Pipeline Combination: N8N + Note-Taking Apps + LangChain Result: Automated content workflow that generates articles with N8N, stores them in Notion with AI summaries, and uses LangChain for advanced processing. Developer Platform Combination: IDE Integration + Autonomous Agents + Chat Interface Result: Developers code with AI assistance in their IDE, use agents for automated testing, and access LibreChat for architecture discussions. 🆚 Comparison: OpenAI vs stdapi.ai ¶ Feature OpenAI API stdapi.ai + Bedrock Data Privacy Sent to OpenAI servers Stays in your AWS environment Models GPT family only Claude, Nova, and more Rate Limits Strict, pay to increase Controlled by your infrastructure Cost High per-token rates AWS pricing (often lower) Compliance Shared responsibility Full control and audit Customization Limited Deploy anywhere, customize everything Vendor Lock-in High Open standard, portable Downtime Risk OpenAI outages affect you You control availability 🚀 Get Started Today ¶ Ready to unlock the power of Amazon Bedrock across all your AI tools? Next Steps 1. Deploy stdapi.ai Follow the Getting Started Guide to deploy stdapi.ai to your infrastructure in minutes. 2. Choose Your Integration Pick one or more use cases from this page that match your needs. 3. Configure & Test Follow the integration-specific guide to connect your application to stdapi.ai. 4. Scale & Optimize Monitor usage, adjust model selection, and expand to additional integrations. 🤝 Community & Support ¶ Need Help? 📖 Documentation — Each integration has detailed step-by-step guides 💬 Integration Communities — Join the Discord/forums for each tool 🐛 Report Issues — GitHub repository 📊 Share Success Stories — Help others by sharing your implementation 🎓 Additional Resources ¶ Learn More ¶ API Overview — Complete list of available models and capabilities Configuration Guide — Advanced stdapi.ai configuration options Chat Completions API — API reference and examples Explore Integrations ¶ Browse the detailed guides for each integration using the navigation menu, or jump directly to: OpenWebUI — Web chat interface N8N — Workflow automation Continue.dev — IDE coding assistant LibreChat — Team chat platform LangChain/LlamaIndex — AI development frameworks Note-Taking Apps — Obsidian & Notion Chat Bots — Slack, Discord, Teams Autonomous Agents — AutoGPT & agent frameworks Start Building Today Every integration is production-ready and battle-tested by thousands of users. Pick your favorite tools, point them to stdapi.ai, and start leveraging Amazon Bedrock's powerful models across your entire workflow. Deploy stdapi.ai once. Use it everywhere. Back to top Previous Logging & Monitoring Next OpenWebUI integration JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#handling-parameter-differences
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#interactive-documentation
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#what-compatible-means
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#quick-start-guide
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#clear-errors-behavior-changing-parameters
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#live-api-playground
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/api_overview/#documentation-resources
Overview - stdapi.ai Skip to content stdapi.ai Overview Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview Overview Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Interactive Documentation 📚 Documentation Resources 🎮 Live API Playground OpenAI SDK-Compatible API Quick Start Guide Understanding Compatibility What "Compatible" Means Handling Parameter Differences Silent Ignoring (Safe Parameters) Clear Errors (Behavior-Changing Parameters) Understanding the Architecture Home Documentation API API Overview ¶ stdapi.ai provides the OpenAI API interface backed by AWS Bedrock foundation models and AWS AI services. Use your existing OpenAI SDKs by simply changing the base URL. Interactive Documentation ¶ stdapi.ai provides multiple interfaces for exploring and testing the API—choose the one that fits your workflow: 📚 Documentation Resources ¶ Complete API Reference – In-depth guides for every endpoint with parameter details OpenAPI Specification – Full machine-readable schema for integration and tooling 🎮 Live API Playground ¶ When running the server , access these interactive interfaces: Interface URL Best For Swagger UI http://localhost/docs Testing endpoints directly in your browser with live request/response examples ReDoc http://localhost/redoc Reading and searching through clean, organized documentation OpenAPI Schema http://localhost/openapi.json Generating client code or importing into API tools like Postman OpenAI SDK-Compatible API ¶ Access AWS-powered AI services through the OpenAI API interface. Use official OpenAI SDKs by simply changing the base URL—no custom clients needed. Supported Endpoints: Category Endpoint Capability Documentation 💬 Chat POST /v1/chat/completions Multi-modal conversations with text, images, video, documents Chat Completions → 🎨 Images POST /v1/images/generations Text-to-image generation Images → 🔊 Audio POST /v1/audio/speech Text-to-speech synthesis Text to Speech → POST /v1/audio/transcriptions Speech-to-text transcription Speech to Text → POST /v1/audio/translations Speech-to-English translation Speech to English → 🧠 Embeddings POST /v1/embeddings Vector embeddings for semantic search Embeddings → 📋 Models GET /v1/models List available models Models → Backend: AWS Bedrock, AWS Polly, AWS Transcribe, AWS Translate SDKs: Official OpenAI SDKs (Python, Node.js, Go, Ruby, etc.) Quick Start Guide ¶ This guide shows how to use stdapi.ai with OpenAI SDKs. stdapi.ai works with official OpenAI client libraries—no custom clients needed: Python pip install openai from openai import OpenAI # Initialize client with your stdapi.ai endpoint client = OpenAI ( base_url = "https://your-deployment-url/v1" , api_key = "your-api-key" ) # Use AWS Bedrock models through the familiar OpenAI interface response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [ { "role" : "system" , "content" : "You are a helpful assistant." }, { "role" : "user" , "content" : "Explain quantum computing in simple terms." } ] ) print ( response . choices [ 0 ] . message . content ) # Pass provider-specific parameter through `extra_body`: response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Solve this complex problem..." }], extra_body = { "top_k" : 0.5 } ) Node.js npm install openai import OpenAI from 'openai' ; // Initialize client with your stdapi.ai endpoint const client = new OpenAI ({ baseURL : 'https://your-deployment-url/v1' , apiKey : 'your-api-key' }); // Use AWS Bedrock models through the familiar OpenAI interface const response = await client . chat . completions . create ({ model : 'amazon.nova-micro-v1:0' , messages : [ { role : 'system' , content : 'You are a helpful assistant.' }, { role : 'user' , content : 'Explain quantum computing in simple terms.' } ] }); console . log ( response . choices [ 0 ]. message . content ); cURL curl -X POST "https://your-deployment-url/v1/chat/completions" \ -H "Authorization: Bearer your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "amazon.nova-micro-v1:0", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Explain quantum computing in simple terms."} ] }' Understanding Compatibility ¶ What "Compatible" Means ¶ stdapi.ai implements the API from source specification with AWS services as the backend. This means: ✅ Same Request Format : Use identical request bodies and parameters ✅ Same Response Structure : Receive responses in the expected format ✅ Same SDKs : Use official client libraries ✅ Drop-in Replacement : Change only the base URL and model ID Handling Parameter Differences ¶ Different providers support different features. stdapi.ai handles this gracefully: Silent Ignoring (Safe Parameters) ¶ Parameters that don't affect output are accepted but ignored: # This works—unsupported parameters are silently ignored response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], user = "user-123" , # Logged but doesn't affect AWS processing ) Clear Errors (Behavior-Changing Parameters) ¶ Parameters that would change output return helpful errors: # This returns HTTP 400 with a clear explanation response = client . chat . completions . create ( model = "amazon.nova-micro-v1:0" , messages = [{ "role" : "user" , "content" : "Hello" }], logit_bias = { 123 : 100 }, # Not supported—clear error returned ) Understanding the Architecture ¶ ┌─────────────────┐ │ Your App │ │ (OpenAI SDK) │ └────────┬────────┘ │ HTTPS /v1/* ▼ ┌─────────────────┐ │ stdapi.ai │ │ API Gateway │ └────────┬────────┘ │ Translates to AWS APIs ┌────┴─────┬──────────┬──────────┐ ▼ ▼ ▼ ▼ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐ │AWS │ │AWS │ │AWS │ │AWS │ │Bedrock │ │Polly │ │Transcr.│ │S3 │ └────────┘ └────────┘ └────────┘ └────────┘ Request Flow: 1. Your application uses the standard OpenAI SDK 2. Requests go to stdapi.ai's /v1/* endpoints instead of OpenAI 3. stdapi.ai translates OpenAI-format requests to AWS service APIs 4. AWS services process the requests 5. Responses are formatted as OpenAI-compatible responses 6. Your application receives familiar OpenAI response structures Ready to build intelligent applications? Start with the Chat Completions API or explore available models ! Back to top Previous Home Next Chat Completions JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/src/Data-Functor-Apply.html
src/Data/Functor/Apply.hs {-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} #endif ----------------------------------------------------------------------------- -- | -- Module : Data.Functor.Apply -- Copyright : (C) 2011 Edward Kmett, -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com> -- Stability : provisional -- Portability : portable -- ---------------------------------------------------------------------------- module Data . Functor . Apply ( -- * Functors Functor ( .. ) , ( <$> ) -- :: Functor f => (a -> b) -> f a -> f b , ( $> ) -- :: Functor f => f a -> b -> f b -- * Apply - a strong lax semimonoidal endofunctor , Apply ( .. ) , ( <..> ) -- :: Apply w => w a -> w (a -> b) -> w b , liftF2 -- :: Apply w => (a -> b -> c) -> w a -> w b -> w c , liftF3 -- :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d -- * Wrappers , WrappedApplicative ( .. ) , MaybeApply ( .. ) ) where import Data . Functor . Bind
2026-01-13T09:30:24
http://hackage.haskell.org/package/transformers-0.4.1.0/docs/Data-Functor-Compose.html#t:Compose
Data.Functor.Compose Source Contents Index transformers-0.4.1.0: Concrete functor and monad transformers Portability portable Stability experimental Maintainer ross@soi.city.ac.uk Safe Haskell Safe-Inferred Data.Functor.Compose Description Composition of functors. Synopsis newtype Compose f g a = Compose { getCompose :: f (g a) } Documentation newtype Compose f g a Source Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad. Constructors Compose   Fields getCompose :: f (g a)   Instances ( Functor f, Functor g) => Functor ( Compose f g)   ( Applicative f, Applicative g) => Applicative ( Compose f g)   ( Foldable f, Foldable g) => Foldable ( Compose f g)   ( Traversable f, Traversable g) => Traversable ( Compose f g)   ( Alternative f, Applicative g) => Alternative ( Compose f g)   ( Functor f, Show1 f, Show1 g) => Show1 ( Compose f g)   ( Functor f, Read1 f, Read1 g) => Read1 ( Compose f g)   ( Functor f, Ord1 f, Ord1 g) => Ord1 ( Compose f g)   ( Functor f, Eq1 f, Eq1 g) => Eq1 ( Compose f g)   ( Functor f, Eq1 f, Eq1 g, Eq a) => Eq ( Compose f g a)   ( Functor f, Ord1 f, Ord1 g, Ord a) => Ord ( Compose f g a)   ( Functor f, Read1 f, Read1 g, Read a) => Read ( Compose f g a)   ( Functor f, Show1 f, Show1 g, Show a) => Show ( Compose f g a)   Produced by Haddock version 2.13.2
2026-01-13T09:30:24
https://freenode.net/terms.html
freenode Autonomous Zone - Terms of Service free node AUTONOMOUS ZONE Terms Privacy Terms of Service freenode Autonomous Zone • Free & Open Source Software Network Effective Date January 1, 2025 [JURISDICTION] freenode operates as an autonomous zone under the Joseon Empire, a recognized cyber nation-state. By connecting, you accept this jurisdiction. If you don't like these terms, disconnect and use a different IRC network. [WHAT YOU CAN DO] freenode exists primarily for free and open source software communities. Use it for your FOSS projects, technical discussion, and building communities around open source software. We're also fine with general tech discussion and other communities, but our focus is FOSS. You can: • Coordinate open source projects • Discuss free software and open standards • Build communities around FOSS • Talk about programming, Linux, and tech • Use bots and automation (reasonably) [WHAT GETS YOU BANNED] Don't break the network. Don't abuse other users. Use common sense. Don't: • Flood or spam channels • Attack the network infrastructure • Impersonate network staff • Run open proxies or botnets • Generally be a pain in the ass [HOW WE OPERATE] freenode is run by volunteers who believe in free and open source software. We keep the lights on and try to stay out of your way. Staff can kick you off if you're causing problems. We don't log your conversations. We do keep connection logs for debugging. If you get banned and think it's unfair, join #help and ask nicely. Need help? → #help Network discussion → #freenode [PRIVACY] Reality check: Other users can log everything you say. Don't assume privacy in public channels. [DISCLAIMERS] freenode works most of the time but sometimes it doesn't. We're not responsible if the network goes down, someone hacks your account, or you lose important data. This is a free service run by volunteers in their spare time. Set your expectations accordingly. Translation: • No uptime guarantees • No data backup promises • No liability for anything, really • You get what you pay for (nothing) [DISPUTES] If you have a problem with how we run things, start in #help. If that doesn't work, you're subject to autonomous zone governance procedures. Realistically: we're pretty reasonable people. Most issues can be sorted out with a conversation. [CHANGES] We can change these terms whenever we want. We'll put updates in the MOTD and on the website. If you keep using the network after changes, you accept them. freenode Autonomous Zone • Free & Open Source Software Network Questions: #help on irc.freenode.net
2026-01-13T09:30:24
http://unicode.org/faq/attribution.html#AF
FAQ - Attributions Tech Site | Site Map | Search Frequently Asked Questions Attributions Many of the FAQ questions and answers have been gathered from the Unicode E-mail Distribution Lists and similar sources. The answers may have been edited considerably from what was originally posted. To credit the original author of the answer, his or her initials are noted in square brackets at the end of the answer, with a link to this page. In particular, we would like to acknowledge the work of Asmus Freytag for designing the style used in the FAQ section of the web site. AF Asmus Freytag AJ Apurva Joshi AP Addison Philips BM Ben Mitchell BY Ben Yang CW Cathy Wissink CWC Craig Cornelius DA Debbie Anderson DB Daniel Biddle DE Doug Ewell EH Ed Hart EM Eric Muller GR George Rhoten JA Joan Aliprand JC John Cowan JDA Julie D. Allen JH Josh Hadley JJ John Jenkins JS Jungshik Shin KL Ken Lunde KP Karl Pentzlin LM Lisa Moore MC Marco Cimarosti MD Mark Davis MK Mike Ksar MS Markus Scherer NL Norbert Lindenberg OS Otto Stolz PC Peter Constable RC Richard Cook SO Sandra O’Donnell SM Shwun Mi SRL Steven R. Loomis TO Tet Orita
2026-01-13T09:30:24
https://rubygems.org/gems/asciidoctor/versions/2.0.26?locale=es
asciidoctor | RubyGems.org | el alojamiento de gemas de tu comunidad ⬢ RubyGems nav#focus mousedown->nav#mouseDown click@window->nav#hide"> Navigation menu autocomplete#choose mouseover->autocomplete#highlight"> Buscar gemas… Releases Blog Gems Guías Ingresa Regístrate asciidoctor 2.0.26 A fast, open source text processor and publishing toolchain for converting AsciiDoc content to HTML 5, DocBook 5, and other formats. Gemfile: = instalar: = Versiones: 2.0.26 October 24, 2025 (278 KB) 2.0.25 October 16, 2025 (278 KB) 2.0.24 October 13, 2025 (278 KB) 2.0.23 May 17, 2024 (277 KB) 2.0.22 March 08, 2024 (276 KB) Mostrar todas las versiones (78 total) dependencias de Development (9): concurrent-ruby ~> 1.1.0 cucumber ~> 3.1.0 erubi ~> 1.10.0 haml ~> 6.3.0 minitest ~> 5.22.0 nokogiri ~> 1.13.0 rake ~> 12.3.0 slim ~> 4.1.0 tilt ~> 2.0.0 Mostrar toda la cadena de dependencias Propietarios: Subida por: Autores: Dan Allen, Sarah White, Ryan Waldron, Jason Porter, Nick Hengeveld, Jeremy McAnally SHA 256 checksum: = ← Versión anterior Total de descargas 52.497.923 Para esta versión 363.442 Versión publicada: October 24, 2025 1:49am Licencia: MIT Versión de Ruby requerida: >= 0 Enlace: Página Registro de cambios Código fuente Lista de Correo Seguimiento de Bugs Descarga Financiación Revisar cambios Badge Suscribirse RSS Reportar abusos Dependencias inversas Estado Uptime Código fuente Datos Estadísticas Contribuye Acerca de Ayuda API Policies Support Us Seguridad RubyGems.org es el servicio de alojamiento de Gemas de la comunidad de Ruby. Publica tus gemas instantáneamente y luego instálalas . Usa la API para saber más sobre las gemas disponibles . Conviértete en colaborador y mejora este sitio con tus cambios. RubyGems.org es posible gracias la colaboración de la fantástica comunidad de Ruby. Fastly provee ancho de banda y soporte de CDN Ruby Central cubre los costos de infraestructura y financia el desarrollo y el trabajo en los servidores. Aprende más sobre nuestros sponsors y cómo trabajan en conjunto Operated by Ruby Central Diseñado por DockYard Alojado por AWS DNS DNSimple Monitoreado por Datadog Distribuida por Fastly Monitoreado por Honeybadger Protegido por Mend.io English Nederlands 简体中文 正體中文 Português do Brasil Français Español Deutsch 日本語
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Data-Foldable.html#t:Foldable
Data.Foldable Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability experimental Maintainer libraries@haskell.org Safe Haskell Trustworthy Data.Foldable Contents Folds Special biased folds Folding actions Applicative actions Monadic actions Specialized folds Searches Description Class of data structures that can be folded to a summary value. Many of these functions generalize Prelude , Control.Monad and Data.List functions of the same names from lists to any Foldable functor. To avoid ambiguity, either import those modules hiding these names or qualify uses of these function names with an alias for this module. Synopsis class Foldable t where fold :: Monoid m => t m -> m foldMap :: Monoid m => (a -> m) -> t a -> m foldr :: (a -> b -> b) -> b -> t a -> b foldr' :: (a -> b -> b) -> b -> t a -> b foldl :: (a -> b -> a) -> a -> t b -> a foldl' :: (a -> b -> a) -> a -> t b -> a foldr1 :: (a -> a -> a) -> t a -> a foldl1 :: (a -> a -> a) -> t a -> a foldrM :: ( Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b foldlM :: ( Foldable t, Monad m) => (a -> b -> m a) -> a -> t b -> m a traverse_ :: ( Foldable t, Applicative f) => (a -> f b) -> t a -> f () for_ :: ( Foldable t, Applicative f) => t a -> (a -> f b) -> f () sequenceA_ :: ( Foldable t, Applicative f) => t (f a) -> f () asum :: ( Foldable t, Alternative f) => t (f a) -> f a mapM_ :: ( Foldable t, Monad m) => (a -> m b) -> t a -> m () forM_ :: ( Foldable t, Monad m) => t a -> (a -> m b) -> m () sequence_ :: ( Foldable t, Monad m) => t (m a) -> m () msum :: ( Foldable t, MonadPlus m) => t (m a) -> m a toList :: Foldable t => t a -> [a] concat :: Foldable t => t [a] -> [a] concatMap :: Foldable t => (a -> [b]) -> t a -> [b] and :: Foldable t => t Bool -> Bool or :: Foldable t => t Bool -> Bool any :: Foldable t => (a -> Bool ) -> t a -> Bool all :: Foldable t => (a -> Bool ) -> t a -> Bool sum :: ( Foldable t, Num a) => t a -> a product :: ( Foldable t, Num a) => t a -> a maximum :: ( Foldable t, Ord a) => t a -> a maximumBy :: Foldable t => (a -> a -> Ordering ) -> t a -> a minimum :: ( Foldable t, Ord a) => t a -> a minimumBy :: Foldable t => (a -> a -> Ordering ) -> t a -> a elem :: ( Foldable t, Eq a) => a -> t a -> Bool notElem :: ( Foldable t, Eq a) => a -> t a -> Bool find :: Foldable t => (a -> Bool ) -> t a -> Maybe a Folds class Foldable t where Source Data structures that can be folded. Minimal complete definition: foldMap or foldr . For example, given a data type data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a) a suitable instance would be instance Foldable Tree where foldMap f Empty = mempty foldMap f (Leaf x) = f x foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r This is suitable even for abstract types, as the monoid is assumed to satisfy the monoid laws. Alternatively, one could define foldr : instance Foldable Tree where foldr f z Empty = z foldr f z (Leaf x) = f x z foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l Methods fold :: Monoid m => t m -> m Source Combine the elements of a structure using a monoid. foldMap :: Monoid m => (a -> m) -> t a -> m Source Map each element of the structure to a monoid, and combine the results. foldr :: (a -> b -> b) -> b -> t a -> b Source Right-associative fold of a structure. foldr f z = foldr f z . toList foldr' :: (a -> b -> b) -> b -> t a -> b Source Right-associative fold of a structure, but with strict application of the operator. foldl :: (a -> b -> a) -> a -> t b -> a Source Left-associative fold of a structure. foldl f z = foldl f z . toList foldl' :: (a -> b -> a) -> a -> t b -> a Source Left-associative fold of a structure. but with strict application of the operator. foldl f z = foldl' f z . toList foldr1 :: (a -> a -> a) -> t a -> a Source A variant of foldr that has no base case, and thus may only be applied to non-empty structures. foldr1 f = foldr1 f . toList foldl1 :: (a -> a -> a) -> t a -> a Source A variant of foldl that has no base case, and thus may only be applied to non-empty structures. foldl1 f = foldl1 f . toList Instances Foldable []   Foldable Maybe   Special biased folds foldrM :: ( Foldable t, Monad m) => (a -> b -> m b) -> b -> t a -> m b Source Monadic fold over the elements of a structure, associating to the right, i.e. from right to left. foldlM :: ( Foldable t, Monad m) => (a -> b -> m a) -> a -> t b -> m a Source Monadic fold over the elements of a structure, associating to the left, i.e. from left to right. Folding actions Applicative actions traverse_ :: ( Foldable t, Applicative f) => (a -> f b) -> t a -> f () Source Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. for_ :: ( Foldable t, Applicative f) => t a -> (a -> f b) -> f () Source for_ is traverse_ with its arguments flipped. sequenceA_ :: ( Foldable t, Applicative f) => t (f a) -> f () Source Evaluate each action in the structure from left to right, and ignore the results. asum :: ( Foldable t, Alternative f) => t (f a) -> f a Source The sum of a collection of actions, generalizing concat . Monadic actions mapM_ :: ( Foldable t, Monad m) => (a -> m b) -> t a -> m () Source Map each element of a structure to a monadic action, evaluate these actions from left to right, and ignore the results. forM_ :: ( Foldable t, Monad m) => t a -> (a -> m b) -> m () Source forM_ is mapM_ with its arguments flipped. sequence_ :: ( Foldable t, Monad m) => t (m a) -> m () Source Evaluate each monadic action in the structure from left to right, and ignore the results. msum :: ( Foldable t, MonadPlus m) => t (m a) -> m a Source The sum of a collection of actions, generalizing concat . Specialized folds toList :: Foldable t => t a -> [a] Source List of elements of a structure. concat :: Foldable t => t [a] -> [a] Source The concatenation of all the elements of a container of lists. concatMap :: Foldable t => (a -> [b]) -> t a -> [b] Source Map a function over all the elements of a container and concatenate the resulting lists. and :: Foldable t => t Bool -> Bool Source and returns the conjunction of a container of Bools. For the result to be True , the container must be finite; False , however, results from a False value finitely far from the left end. or :: Foldable t => t Bool -> Bool Source or returns the disjunction of a container of Bools. For the result to be False , the container must be finite; True , however, results from a True value finitely far from the left end. any :: Foldable t => (a -> Bool ) -> t a -> Bool Source Determines whether any element of the structure satisfies the predicate. all :: Foldable t => (a -> Bool ) -> t a -> Bool Source Determines whether all elements of the structure satisfy the predicate. sum :: ( Foldable t, Num a) => t a -> a Source The sum function computes the sum of the numbers of a structure. product :: ( Foldable t, Num a) => t a -> a Source The product function computes the product of the numbers of a structure. maximum :: ( Foldable t, Ord a) => t a -> a Source The largest element of a non-empty structure. maximumBy :: Foldable t => (a -> a -> Ordering ) -> t a -> a Source The largest element of a non-empty structure with respect to the given comparison function. minimum :: ( Foldable t, Ord a) => t a -> a Source The least element of a non-empty structure. minimumBy :: Foldable t => (a -> a -> Ordering ) -> t a -> a Source The least element of a non-empty structure with respect to the given comparison function. Searches elem :: ( Foldable t, Eq a) => a -> t a -> Bool Source Does the element occur in the structure? notElem :: ( Foldable t, Eq a) => a -> t a -> Bool Source notElem is the negation of elem . find :: Foldable t => (a -> Bool ) -> t a -> Maybe a Source The find function takes a predicate and a structure and returns the leftmost element of the structure matching the predicate, or Nothing if there is no such element. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Arrow.html#t:Arrow
Control.Arrow Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability provisional Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Arrow Contents Arrows Derived combinators Right-to-left variants Monoid operations Conditionals Arrow application Feedback Description Basic arrow definitions, based on * Generalising Monads to Arrows , by John Hughes, Science of Computer Programming 37, pp67-111, May 2000. plus a couple of definitions ( returnA and loop ) from * A New Notation for Arrows , by Ross Paterson, in ICFP 2001 , Firenze, Italy, pp229-240. These papers and more information on arrows can be found at http://www.haskell.org/arrows/ . Synopsis class Category a => Arrow a where arr :: (b -> c) -> a b c first :: a b c -> a (b, d) (c, d) second :: a b c -> a (d, b) (d, c) (***) :: a b c -> a b' c' -> a (b, b') (c, c') (&&&) :: a b c -> a b c' -> a b (c, c') newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b } returnA :: Arrow a => a b b (^>>) :: Arrow a => (b -> c) -> a c d -> a b d (>>^) :: Arrow a => a b c -> (c -> d) -> a b d (>>>) :: Category cat => cat a b -> cat b c -> cat a c (<<<) :: Category cat => cat b c -> cat a b -> cat a c (<<^) :: Arrow a => a c d -> (b -> c) -> a b d (^<<) :: Arrow a => (c -> d) -> a b c -> a b d class Arrow a => ArrowZero a where zeroArrow :: a b c class ArrowZero a => ArrowPlus a where (<+>) :: a b c -> a b c -> a b c class Arrow a => ArrowChoice a where left :: a b c -> a ( Either b d) ( Either c d) right :: a b c -> a ( Either d b) ( Either d c) (+++) :: a b c -> a b' c' -> a ( Either b b') ( Either c c') (|||) :: a b d -> a c d -> a ( Either b c) d class Arrow a => ArrowApply a where app :: a (a b c, b) c newtype ArrowMonad a b = ArrowMonad (a () b) leftApp :: ArrowApply a => a b c -> a ( Either b d) ( Either c d) class Arrow a => ArrowLoop a where loop :: a (b, d) (c, d) -> a b c Arrows class Category a => Arrow a where Source The basic arrow class. Minimal complete definition: arr and first , satisfying the laws arr id = id arr (f >>> g) = arr f >>> arr g first ( arr f) = arr ( first f) first (f >>> g) = first f >>> first g first f >>> arr fst = arr fst >>> f first f >>> arr ( id *** g) = arr ( id *** g) >>> first f first ( first f) >>> arr assoc = arr assoc >>> first f where assoc ((a,b),c) = (a,(b,c)) The other combinators have sensible default definitions, which may be overridden for efficiency. Methods arr :: (b -> c) -> a b c Source Lift a function to an arrow. first :: a b c -> a (b, d) (c, d) Source Send the first component of the input through the argument arrow, and copy the rest unchanged to the output. second :: a b c -> a (d, b) (d, c) Source A mirror image of first . The default definition may be overridden with a more efficient version if desired. (***) :: a b c -> a b' c' -> a (b, b') (c, c') Source Split the input between the two argument arrows and combine their output. Note that this is in general not a functor. The default definition may be overridden with a more efficient version if desired. (&&&) :: a b c -> a b c' -> a b (c, c') Source Fanout: send the input to both argument arrows and combine their output. The default definition may be overridden with a more efficient version if desired. Instances Arrow (->)   Monad m => Arrow ( Kleisli m)   newtype Kleisli m a b Source Kleisli arrows of a monad. Constructors Kleisli   Fields runKleisli :: a -> m b   Instances Monad m => Category ( Kleisli m)   MonadFix m => ArrowLoop ( Kleisli m) Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class. Monad m => ArrowApply ( Kleisli m)   Monad m => ArrowChoice ( Kleisli m)   MonadPlus m => ArrowPlus ( Kleisli m)   MonadPlus m => ArrowZero ( Kleisli m)   Monad m => Arrow ( Kleisli m)   Derived combinators returnA :: Arrow a => a b b Source The identity arrow, which plays the role of return in arrow notation. (^>>) :: Arrow a => (b -> c) -> a c d -> a b d Source Precomposition with a pure function. (>>^) :: Arrow a => a b c -> (c -> d) -> a b d Source Postcomposition with a pure function. (>>>) :: Category cat => cat a b -> cat b c -> cat a c Source Left-to-right composition (<<<) :: Category cat => cat b c -> cat a b -> cat a c Source Right-to-left composition Right-to-left variants (<<^) :: Arrow a => a c d -> (b -> c) -> a b d Source Precomposition with a pure function (right-to-left variant). (^<<) :: Arrow a => (c -> d) -> a b c -> a b d Source Postcomposition with a pure function (right-to-left variant). Monoid operations class Arrow a => ArrowZero a where Source Methods zeroArrow :: a b c Source Instances MonadPlus m => ArrowZero ( Kleisli m)   class ArrowZero a => ArrowPlus a where Source A monoid on arrows. Methods (<+>) :: a b c -> a b c -> a b c Source An associative operation with identity zeroArrow . Instances MonadPlus m => ArrowPlus ( Kleisli m)   Conditionals class Arrow a => ArrowChoice a where Source Choice, for arrows that support it. This class underlies the if and case constructs in arrow notation. Minimal complete definition: left , satisfying the laws left ( arr f) = arr ( left f) left (f >>> g) = left f >>> left g f >>> arr Left = arr Left >>> left f left f >>> arr ( id +++ g) = arr ( id +++ g) >>> left f left ( left f) >>> arr assocsum = arr assocsum >>> left f where assocsum (Left (Left x)) = Left x assocsum (Left (Right y)) = Right (Left y) assocsum (Right z) = Right (Right z) The other combinators have sensible default definitions, which may be overridden for efficiency. Methods left :: a b c -> a ( Either b d) ( Either c d) Source Feed marked inputs through the argument arrow, passing the rest through unchanged to the output. right :: a b c -> a ( Either d b) ( Either d c) Source A mirror image of left . The default definition may be overridden with a more efficient version if desired. (+++) :: a b c -> a b' c' -> a ( Either b b') ( Either c c') Source Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor. The default definition may be overridden with a more efficient version if desired. (|||) :: a b d -> a c d -> a ( Either b c) d Source Fanin: Split the input between the two argument arrows and merge their outputs. The default definition may be overridden with a more efficient version if desired. Instances ArrowChoice (->)   Monad m => ArrowChoice ( Kleisli m)   Arrow application class Arrow a => ArrowApply a where Source Some arrows allow application of arrow inputs to other inputs. Instances should satisfy the following laws: first ( arr (\x -> arr (\y -> (x,y)))) >>> app = id first ( arr (g >>>)) >>> app = second g >>> app first ( arr (>>> h)) >>> app = app >>> h Such arrows are equivalent to monads (see ArrowMonad ). Methods app :: a (a b c, b) c Source Instances ArrowApply (->)   Monad m => ArrowApply ( Kleisli m)   newtype ArrowMonad a b Source The ArrowApply class is equivalent to Monad : any monad gives rise to a Kleisli arrow, and any instance of ArrowApply defines a monad. Constructors ArrowMonad (a () b)   Instances ArrowApply a => Monad ( ArrowMonad a)   Arrow a => Functor ( ArrowMonad a)   ( ArrowApply a, ArrowPlus a) => MonadPlus ( ArrowMonad a)   Arrow a => Applicative ( ArrowMonad a)   ArrowPlus a => Alternative ( ArrowMonad a)   leftApp :: ArrowApply a => a b c -> a ( Either b d) ( Either c d) Source Any instance of ArrowApply can be made into an instance of ArrowChoice by defining left = leftApp . Feedback class Arrow a => ArrowLoop a where Source The loop operator expresses computations in which an output value is fed back as input, although the computation occurs only once. It underlies the rec value recursion construct in arrow notation. loop should satisfy the following laws: extension loop ( arr f) = arr (\ b -> fst ( fix (\ (c,d) -> f (b,d)))) left tightening loop ( first h >>> f) = h >>> loop f right tightening loop (f >>> first h) = loop f >>> h sliding loop (f >>> arr ( id *** k)) = loop ( arr ( id *** k) >>> f) vanishing loop ( loop f) = loop ( arr unassoc >>> f >>> arr assoc) superposing second ( loop f) = loop ( arr assoc >>> second f >>> arr unassoc) where assoc ((a,b),c) = (a,(b,c)) unassoc (a,(b,c)) = ((a,b),c) Methods loop :: a (b, d) (c, d) -> a b c Source Instances ArrowLoop (->)   MonadFix m => ArrowLoop ( Kleisli m) Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Arrow.html#t:Kleisli
Control.Arrow Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability provisional Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Arrow Contents Arrows Derived combinators Right-to-left variants Monoid operations Conditionals Arrow application Feedback Description Basic arrow definitions, based on * Generalising Monads to Arrows , by John Hughes, Science of Computer Programming 37, pp67-111, May 2000. plus a couple of definitions ( returnA and loop ) from * A New Notation for Arrows , by Ross Paterson, in ICFP 2001 , Firenze, Italy, pp229-240. These papers and more information on arrows can be found at http://www.haskell.org/arrows/ . Synopsis class Category a => Arrow a where arr :: (b -> c) -> a b c first :: a b c -> a (b, d) (c, d) second :: a b c -> a (d, b) (d, c) (***) :: a b c -> a b' c' -> a (b, b') (c, c') (&&&) :: a b c -> a b c' -> a b (c, c') newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b } returnA :: Arrow a => a b b (^>>) :: Arrow a => (b -> c) -> a c d -> a b d (>>^) :: Arrow a => a b c -> (c -> d) -> a b d (>>>) :: Category cat => cat a b -> cat b c -> cat a c (<<<) :: Category cat => cat b c -> cat a b -> cat a c (<<^) :: Arrow a => a c d -> (b -> c) -> a b d (^<<) :: Arrow a => (c -> d) -> a b c -> a b d class Arrow a => ArrowZero a where zeroArrow :: a b c class ArrowZero a => ArrowPlus a where (<+>) :: a b c -> a b c -> a b c class Arrow a => ArrowChoice a where left :: a b c -> a ( Either b d) ( Either c d) right :: a b c -> a ( Either d b) ( Either d c) (+++) :: a b c -> a b' c' -> a ( Either b b') ( Either c c') (|||) :: a b d -> a c d -> a ( Either b c) d class Arrow a => ArrowApply a where app :: a (a b c, b) c newtype ArrowMonad a b = ArrowMonad (a () b) leftApp :: ArrowApply a => a b c -> a ( Either b d) ( Either c d) class Arrow a => ArrowLoop a where loop :: a (b, d) (c, d) -> a b c Arrows class Category a => Arrow a where Source The basic arrow class. Minimal complete definition: arr and first , satisfying the laws arr id = id arr (f >>> g) = arr f >>> arr g first ( arr f) = arr ( first f) first (f >>> g) = first f >>> first g first f >>> arr fst = arr fst >>> f first f >>> arr ( id *** g) = arr ( id *** g) >>> first f first ( first f) >>> arr assoc = arr assoc >>> first f where assoc ((a,b),c) = (a,(b,c)) The other combinators have sensible default definitions, which may be overridden for efficiency. Methods arr :: (b -> c) -> a b c Source Lift a function to an arrow. first :: a b c -> a (b, d) (c, d) Source Send the first component of the input through the argument arrow, and copy the rest unchanged to the output. second :: a b c -> a (d, b) (d, c) Source A mirror image of first . The default definition may be overridden with a more efficient version if desired. (***) :: a b c -> a b' c' -> a (b, b') (c, c') Source Split the input between the two argument arrows and combine their output. Note that this is in general not a functor. The default definition may be overridden with a more efficient version if desired. (&&&) :: a b c -> a b c' -> a b (c, c') Source Fanout: send the input to both argument arrows and combine their output. The default definition may be overridden with a more efficient version if desired. Instances Arrow (->)   Monad m => Arrow ( Kleisli m)   newtype Kleisli m a b Source Kleisli arrows of a monad. Constructors Kleisli   Fields runKleisli :: a -> m b   Instances Monad m => Category ( Kleisli m)   MonadFix m => ArrowLoop ( Kleisli m) Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class. Monad m => ArrowApply ( Kleisli m)   Monad m => ArrowChoice ( Kleisli m)   MonadPlus m => ArrowPlus ( Kleisli m)   MonadPlus m => ArrowZero ( Kleisli m)   Monad m => Arrow ( Kleisli m)   Derived combinators returnA :: Arrow a => a b b Source The identity arrow, which plays the role of return in arrow notation. (^>>) :: Arrow a => (b -> c) -> a c d -> a b d Source Precomposition with a pure function. (>>^) :: Arrow a => a b c -> (c -> d) -> a b d Source Postcomposition with a pure function. (>>>) :: Category cat => cat a b -> cat b c -> cat a c Source Left-to-right composition (<<<) :: Category cat => cat b c -> cat a b -> cat a c Source Right-to-left composition Right-to-left variants (<<^) :: Arrow a => a c d -> (b -> c) -> a b d Source Precomposition with a pure function (right-to-left variant). (^<<) :: Arrow a => (c -> d) -> a b c -> a b d Source Postcomposition with a pure function (right-to-left variant). Monoid operations class Arrow a => ArrowZero a where Source Methods zeroArrow :: a b c Source Instances MonadPlus m => ArrowZero ( Kleisli m)   class ArrowZero a => ArrowPlus a where Source A monoid on arrows. Methods (<+>) :: a b c -> a b c -> a b c Source An associative operation with identity zeroArrow . Instances MonadPlus m => ArrowPlus ( Kleisli m)   Conditionals class Arrow a => ArrowChoice a where Source Choice, for arrows that support it. This class underlies the if and case constructs in arrow notation. Minimal complete definition: left , satisfying the laws left ( arr f) = arr ( left f) left (f >>> g) = left f >>> left g f >>> arr Left = arr Left >>> left f left f >>> arr ( id +++ g) = arr ( id +++ g) >>> left f left ( left f) >>> arr assocsum = arr assocsum >>> left f where assocsum (Left (Left x)) = Left x assocsum (Left (Right y)) = Right (Left y) assocsum (Right z) = Right (Right z) The other combinators have sensible default definitions, which may be overridden for efficiency. Methods left :: a b c -> a ( Either b d) ( Either c d) Source Feed marked inputs through the argument arrow, passing the rest through unchanged to the output. right :: a b c -> a ( Either d b) ( Either d c) Source A mirror image of left . The default definition may be overridden with a more efficient version if desired. (+++) :: a b c -> a b' c' -> a ( Either b b') ( Either c c') Source Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor. The default definition may be overridden with a more efficient version if desired. (|||) :: a b d -> a c d -> a ( Either b c) d Source Fanin: Split the input between the two argument arrows and merge their outputs. The default definition may be overridden with a more efficient version if desired. Instances ArrowChoice (->)   Monad m => ArrowChoice ( Kleisli m)   Arrow application class Arrow a => ArrowApply a where Source Some arrows allow application of arrow inputs to other inputs. Instances should satisfy the following laws: first ( arr (\x -> arr (\y -> (x,y)))) >>> app = id first ( arr (g >>>)) >>> app = second g >>> app first ( arr (>>> h)) >>> app = app >>> h Such arrows are equivalent to monads (see ArrowMonad ). Methods app :: a (a b c, b) c Source Instances ArrowApply (->)   Monad m => ArrowApply ( Kleisli m)   newtype ArrowMonad a b Source The ArrowApply class is equivalent to Monad : any monad gives rise to a Kleisli arrow, and any instance of ArrowApply defines a monad. Constructors ArrowMonad (a () b)   Instances ArrowApply a => Monad ( ArrowMonad a)   Arrow a => Functor ( ArrowMonad a)   ( ArrowApply a, ArrowPlus a) => MonadPlus ( ArrowMonad a)   Arrow a => Applicative ( ArrowMonad a)   ArrowPlus a => Alternative ( ArrowMonad a)   leftApp :: ArrowApply a => a b c -> a ( Either b d) ( Either c d) Source Any instance of ArrowApply can be made into an instance of ArrowChoice by defining left = leftApp . Feedback class Arrow a => ArrowLoop a where Source The loop operator expresses computations in which an output value is fed back as input, although the computation occurs only once. It underlies the rec value recursion construct in arrow notation. loop should satisfy the following laws: extension loop ( arr f) = arr (\ b -> fst ( fix (\ (c,d) -> f (b,d)))) left tightening loop ( first h >>> f) = h >>> loop f right tightening loop (f >>> first h) = loop f >>> h sliding loop (f >>> arr ( id *** k)) = loop ( arr ( id *** k) >>> f) vanishing loop ( loop f) = loop ( arr unassoc >>> f >>> arr assoc) superposing second ( loop f) = loop ( arr assoc >>> second f >>> arr unassoc) where assoc ((a,b),c) = (a,(b,c)) unassoc (a,(b,c)) = ((a,b),c) Methods loop :: a (b, d) (c, d) -> a b c Source Instances ArrowLoop (->)   MonadFix m => ArrowLoop ( Kleisli m) Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Text-ParserCombinators-ReadP.html#t:ReadP
Text.ParserCombinators.ReadP Source Contents Index base-4.6.0.1: Basic libraries Portability non-portable (local universal quantification) Stability provisional Maintainer libraries@haskell.org Safe Haskell Trustworthy Text.ParserCombinators.ReadP Contents The ReadP type Primitive operations Other operations Running a parser Properties Description This is a library of parser combinators, originally written by Koen Claessen. It parses all alternatives in parallel, so it never keeps hold of the beginning of the input string, a common source of space leaks with other parsers. The '(+++)' choice combinator is genuinely commutative; it makes no difference which branch is "shorter". Synopsis data ReadP a get :: ReadP Char look :: ReadP String (+++) :: ReadP a -> ReadP a -> ReadP a (<++) :: ReadP a -> ReadP a -> ReadP a gather :: ReadP a -> ReadP ( String , a) pfail :: ReadP a eof :: ReadP () satisfy :: ( Char -> Bool ) -> ReadP Char char :: Char -> ReadP Char string :: String -> ReadP String munch :: ( Char -> Bool ) -> ReadP String munch1 :: ( Char -> Bool ) -> ReadP String skipSpaces :: ReadP () choice :: [ ReadP a] -> ReadP a count :: Int -> ReadP a -> ReadP [a] between :: ReadP open -> ReadP close -> ReadP a -> ReadP a option :: a -> ReadP a -> ReadP a optional :: ReadP a -> ReadP () many :: ReadP a -> ReadP [a] many1 :: ReadP a -> ReadP [a] skipMany :: ReadP a -> ReadP () skipMany1 :: ReadP a -> ReadP () sepBy :: ReadP a -> ReadP sep -> ReadP [a] sepBy1 :: ReadP a -> ReadP sep -> ReadP [a] endBy :: ReadP a -> ReadP sep -> ReadP [a] endBy1 :: ReadP a -> ReadP sep -> ReadP [a] chainr :: ReadP a -> ReadP (a -> a -> a) -> a -> ReadP a chainl :: ReadP a -> ReadP (a -> a -> a) -> a -> ReadP a chainl1 :: ReadP a -> ReadP (a -> a -> a) -> ReadP a chainr1 :: ReadP a -> ReadP (a -> a -> a) -> ReadP a manyTill :: ReadP a -> ReadP end -> ReadP [a] type ReadS a = String -> [(a, String )] readP_to_S :: ReadP a -> ReadS a readS_to_P :: ReadS a -> ReadP a The ReadP type data ReadP a Source Instances Monad ReadP   Functor ReadP   MonadPlus ReadP   Applicative ReadP   Alternative ReadP   Primitive operations get :: ReadP Char Source Consumes and returns the next character. Fails if there is no input left. look :: ReadP String Source Look-ahead: returns the part of the input that is left, without consuming it. (+++) :: ReadP a -> ReadP a -> ReadP a Source Symmetric choice. (<++) :: ReadP a -> ReadP a -> ReadP a Source Local, exclusive, left-biased choice: If left parser locally produces any result at all, then right parser is not used. gather :: ReadP a -> ReadP ( String , a) Source Transforms a parser into one that does the same, but in addition returns the exact characters read. IMPORTANT NOTE: gather gives a runtime error if its first argument is built using any occurrences of readS_to_P. Other operations pfail :: ReadP a Source Always fails. eof :: ReadP () Source Succeeds iff we are at the end of input satisfy :: ( Char -> Bool ) -> ReadP Char Source Consumes and returns the next character, if it satisfies the specified predicate. char :: Char -> ReadP Char Source Parses and returns the specified character. string :: String -> ReadP String Source Parses and returns the specified string. munch :: ( Char -> Bool ) -> ReadP String Source Parses the first zero or more characters satisfying the predicate. Always succeds, exactly once having consumed all the characters Hence NOT the same as (many (satisfy p)) munch1 :: ( Char -> Bool ) -> ReadP String Source Parses the first one or more characters satisfying the predicate. Fails if none, else succeeds exactly once having consumed all the characters Hence NOT the same as (many1 (satisfy p)) skipSpaces :: ReadP () Source Skips all whitespace. choice :: [ ReadP a] -> ReadP a Source Combines all parsers in the specified list. count :: Int -> ReadP a -> ReadP [a] Source count n p parses n occurrences of p in sequence. A list of results is returned. between :: ReadP open -> ReadP close -> ReadP a -> ReadP a Source between open close p parses open , followed by p and finally close . Only the value of p is returned. option :: a -> ReadP a -> ReadP a Source option x p will either parse p or return x without consuming any input. optional :: ReadP a -> ReadP () Source optional p optionally parses p and always returns () . many :: ReadP a -> ReadP [a] Source Parses zero or more occurrences of the given parser. many1 :: ReadP a -> ReadP [a] Source Parses one or more occurrences of the given parser. skipMany :: ReadP a -> ReadP () Source Like many , but discards the result. skipMany1 :: ReadP a -> ReadP () Source Like many1 , but discards the result. sepBy :: ReadP a -> ReadP sep -> ReadP [a] Source sepBy p sep parses zero or more occurrences of p , separated by sep . Returns a list of values returned by p . sepBy1 :: ReadP a -> ReadP sep -> ReadP [a] Source sepBy1 p sep parses one or more occurrences of p , separated by sep . Returns a list of values returned by p . endBy :: ReadP a -> ReadP sep -> ReadP [a] Source endBy p sep parses zero or more occurrences of p , separated and ended by sep . endBy1 :: ReadP a -> ReadP sep -> ReadP [a] Source endBy p sep parses one or more occurrences of p , separated and ended by sep . chainr :: ReadP a -> ReadP (a -> a -> a) -> a -> ReadP a Source chainr p op x parses zero or more occurrences of p , separated by op . Returns a value produced by a right associative application of all functions returned by op . If there are no occurrences of p , x is returned. chainl :: ReadP a -> ReadP (a -> a -> a) -> a -> ReadP a Source chainl p op x parses zero or more occurrences of p , separated by op . Returns a value produced by a left associative application of all functions returned by op . If there are no occurrences of p , x is returned. chainl1 :: ReadP a -> ReadP (a -> a -> a) -> ReadP a Source Like chainl , but parses one or more occurrences of p . chainr1 :: ReadP a -> ReadP (a -> a -> a) -> ReadP a Source Like chainr , but parses one or more occurrences of p . manyTill :: ReadP a -> ReadP end -> ReadP [a] Source manyTill p end parses zero or more occurrences of p , until end succeeds. Returns a list of values returned by p . Running a parser type ReadS a = String -> [(a, String )] Source A parser for a type a , represented as a function that takes a String and returns a list of possible parses as (a, String ) pairs. Note that this kind of backtracking parser is very inefficient; reading a large structure may be quite slow (cf ReadP ). readP_to_S :: ReadP a -> ReadS a Source Converts a parser into a Haskell ReadS-style function. This is the main way in which you can "run" a ReadP parser: the expanded type is readP_to_S :: ReadP a -> String -> [(a,String)] readS_to_P :: ReadS a -> ReadP a Source Converts a Haskell ReadS-style function into a parser. Warning: This introduces local backtracking in the resulting parser, and therefore a possible inefficiency. Properties The following are QuickCheck specifications of what the combinators do. These can be seen as formal specifications of the behavior of the combinators. We use bags to give semantics to the combinators. type Bag a = [a] Equality on bags does not care about the order of elements. (=~) :: Ord a => Bag a -> Bag a -> Bool xs =~ ys = sort xs == sort ys A special equality operator to avoid unresolved overloading when testing the properties. (=~.) :: Bag (Int,String) -> Bag (Int,String) -> Bool (=~.) = (=~) Here follow the properties: prop_Get_Nil = readP_to_S get [] =~ [] prop_Get_Cons c s = readP_to_S get (c:s) =~ [(c,s)] prop_Look s = readP_to_S look s =~ [(s,s)] prop_Fail s = readP_to_S pfail s =~. [] prop_Return x s = readP_to_S (return x) s =~. [(x,s)] prop_Bind p k s = readP_to_S (p >>= k) s =~. [ ys'' | (x,s') <- readP_to_S p s , ys'' <- readP_to_S (k (x::Int)) s' ] prop_Plus p q s = readP_to_S (p +++ q) s =~. (readP_to_S p s ++ readP_to_S q s) prop_LeftPlus p q s = readP_to_S (p <++ q) s =~. (readP_to_S p s +<+ readP_to_S q s) where [] +<+ ys = ys xs +<+ _ = xs prop_Gather s = forAll readPWithoutReadS $ \p -> readP_to_S (gather p) s =~ [ ((pre,x::Int),s') | (x,s') <- readP_to_S p s , let pre = take (length s - length s') s ] prop_String_Yes this s = readP_to_S (string this) (this ++ s) =~ [(this,s)] prop_String_Maybe this s = readP_to_S (string this) s =~ [(this, drop (length this) s) | this `isPrefixOf` s] prop_Munch p s = readP_to_S (munch p) s =~ [(takeWhile p s, dropWhile p s)] prop_Munch1 p s = readP_to_S (munch1 p) s =~ [(res,s') | let (res,s') = (takeWhile p s, dropWhile p s), not (null res)] prop_Choice ps s = readP_to_S (choice ps) s =~. readP_to_S (foldr (+++) pfail ps) s prop_ReadS r s = readP_to_S (readS_to_P r) s =~. r s Produced by Haddock version 2.13.2
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Arrow.html#t:Kleisli
Control.Arrow Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability provisional Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Arrow Contents Arrows Derived combinators Right-to-left variants Monoid operations Conditionals Arrow application Feedback Description Basic arrow definitions, based on * Generalising Monads to Arrows , by John Hughes, Science of Computer Programming 37, pp67-111, May 2000. plus a couple of definitions ( returnA and loop ) from * A New Notation for Arrows , by Ross Paterson, in ICFP 2001 , Firenze, Italy, pp229-240. These papers and more information on arrows can be found at http://www.haskell.org/arrows/ . Synopsis class Category a => Arrow a where arr :: (b -> c) -> a b c first :: a b c -> a (b, d) (c, d) second :: a b c -> a (d, b) (d, c) (***) :: a b c -> a b' c' -> a (b, b') (c, c') (&&&) :: a b c -> a b c' -> a b (c, c') newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b } returnA :: Arrow a => a b b (^>>) :: Arrow a => (b -> c) -> a c d -> a b d (>>^) :: Arrow a => a b c -> (c -> d) -> a b d (>>>) :: Category cat => cat a b -> cat b c -> cat a c (<<<) :: Category cat => cat b c -> cat a b -> cat a c (<<^) :: Arrow a => a c d -> (b -> c) -> a b d (^<<) :: Arrow a => (c -> d) -> a b c -> a b d class Arrow a => ArrowZero a where zeroArrow :: a b c class ArrowZero a => ArrowPlus a where (<+>) :: a b c -> a b c -> a b c class Arrow a => ArrowChoice a where left :: a b c -> a ( Either b d) ( Either c d) right :: a b c -> a ( Either d b) ( Either d c) (+++) :: a b c -> a b' c' -> a ( Either b b') ( Either c c') (|||) :: a b d -> a c d -> a ( Either b c) d class Arrow a => ArrowApply a where app :: a (a b c, b) c newtype ArrowMonad a b = ArrowMonad (a () b) leftApp :: ArrowApply a => a b c -> a ( Either b d) ( Either c d) class Arrow a => ArrowLoop a where loop :: a (b, d) (c, d) -> a b c Arrows class Category a => Arrow a where Source The basic arrow class. Minimal complete definition: arr and first , satisfying the laws arr id = id arr (f >>> g) = arr f >>> arr g first ( arr f) = arr ( first f) first (f >>> g) = first f >>> first g first f >>> arr fst = arr fst >>> f first f >>> arr ( id *** g) = arr ( id *** g) >>> first f first ( first f) >>> arr assoc = arr assoc >>> first f where assoc ((a,b),c) = (a,(b,c)) The other combinators have sensible default definitions, which may be overridden for efficiency. Methods arr :: (b -> c) -> a b c Source Lift a function to an arrow. first :: a b c -> a (b, d) (c, d) Source Send the first component of the input through the argument arrow, and copy the rest unchanged to the output. second :: a b c -> a (d, b) (d, c) Source A mirror image of first . The default definition may be overridden with a more efficient version if desired. (***) :: a b c -> a b' c' -> a (b, b') (c, c') Source Split the input between the two argument arrows and combine their output. Note that this is in general not a functor. The default definition may be overridden with a more efficient version if desired. (&&&) :: a b c -> a b c' -> a b (c, c') Source Fanout: send the input to both argument arrows and combine their output. The default definition may be overridden with a more efficient version if desired. Instances Arrow (->)   Monad m => Arrow ( Kleisli m)   newtype Kleisli m a b Source Kleisli arrows of a monad. Constructors Kleisli   Fields runKleisli :: a -> m b   Instances Monad m => Category ( Kleisli m)   MonadFix m => ArrowLoop ( Kleisli m) Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class. Monad m => ArrowApply ( Kleisli m)   Monad m => ArrowChoice ( Kleisli m)   MonadPlus m => ArrowPlus ( Kleisli m)   MonadPlus m => ArrowZero ( Kleisli m)   Monad m => Arrow ( Kleisli m)   Derived combinators returnA :: Arrow a => a b b Source The identity arrow, which plays the role of return in arrow notation. (^>>) :: Arrow a => (b -> c) -> a c d -> a b d Source Precomposition with a pure function. (>>^) :: Arrow a => a b c -> (c -> d) -> a b d Source Postcomposition with a pure function. (>>>) :: Category cat => cat a b -> cat b c -> cat a c Source Left-to-right composition (<<<) :: Category cat => cat b c -> cat a b -> cat a c Source Right-to-left composition Right-to-left variants (<<^) :: Arrow a => a c d -> (b -> c) -> a b d Source Precomposition with a pure function (right-to-left variant). (^<<) :: Arrow a => (c -> d) -> a b c -> a b d Source Postcomposition with a pure function (right-to-left variant). Monoid operations class Arrow a => ArrowZero a where Source Methods zeroArrow :: a b c Source Instances MonadPlus m => ArrowZero ( Kleisli m)   class ArrowZero a => ArrowPlus a where Source A monoid on arrows. Methods (<+>) :: a b c -> a b c -> a b c Source An associative operation with identity zeroArrow . Instances MonadPlus m => ArrowPlus ( Kleisli m)   Conditionals class Arrow a => ArrowChoice a where Source Choice, for arrows that support it. This class underlies the if and case constructs in arrow notation. Minimal complete definition: left , satisfying the laws left ( arr f) = arr ( left f) left (f >>> g) = left f >>> left g f >>> arr Left = arr Left >>> left f left f >>> arr ( id +++ g) = arr ( id +++ g) >>> left f left ( left f) >>> arr assocsum = arr assocsum >>> left f where assocsum (Left (Left x)) = Left x assocsum (Left (Right y)) = Right (Left y) assocsum (Right z) = Right (Right z) The other combinators have sensible default definitions, which may be overridden for efficiency. Methods left :: a b c -> a ( Either b d) ( Either c d) Source Feed marked inputs through the argument arrow, passing the rest through unchanged to the output. right :: a b c -> a ( Either d b) ( Either d c) Source A mirror image of left . The default definition may be overridden with a more efficient version if desired. (+++) :: a b c -> a b' c' -> a ( Either b b') ( Either c c') Source Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor. The default definition may be overridden with a more efficient version if desired. (|||) :: a b d -> a c d -> a ( Either b c) d Source Fanin: Split the input between the two argument arrows and merge their outputs. The default definition may be overridden with a more efficient version if desired. Instances ArrowChoice (->)   Monad m => ArrowChoice ( Kleisli m)   Arrow application class Arrow a => ArrowApply a where Source Some arrows allow application of arrow inputs to other inputs. Instances should satisfy the following laws: first ( arr (\x -> arr (\y -> (x,y)))) >>> app = id first ( arr (g >>>)) >>> app = second g >>> app first ( arr (>>> h)) >>> app = app >>> h Such arrows are equivalent to monads (see ArrowMonad ). Methods app :: a (a b c, b) c Source Instances ArrowApply (->)   Monad m => ArrowApply ( Kleisli m)   newtype ArrowMonad a b Source The ArrowApply class is equivalent to Monad : any monad gives rise to a Kleisli arrow, and any instance of ArrowApply defines a monad. Constructors ArrowMonad (a () b)   Instances ArrowApply a => Monad ( ArrowMonad a)   Arrow a => Functor ( ArrowMonad a)   ( ArrowApply a, ArrowPlus a) => MonadPlus ( ArrowMonad a)   Arrow a => Applicative ( ArrowMonad a)   ArrowPlus a => Alternative ( ArrowMonad a)   leftApp :: ArrowApply a => a b c -> a ( Either b d) ( Either c d) Source Any instance of ArrowApply can be made into an instance of ArrowChoice by defining left = leftApp . Feedback class Arrow a => ArrowLoop a where Source The loop operator expresses computations in which an output value is fed back as input, although the computation occurs only once. It underlies the rec value recursion construct in arrow notation. loop should satisfy the following laws: extension loop ( arr f) = arr (\ b -> fst ( fix (\ (c,d) -> f (b,d)))) left tightening loop ( first h >>> f) = h >>> loop f right tightening loop (f >>> first h) = loop f >>> h sliding loop (f >>> arr ( id *** k)) = loop ( arr ( id *** k) >>> f) vanishing loop ( loop f) = loop ( arr unassoc >>> f >>> arr assoc) superposing second ( loop f) = loop ( arr assoc >>> second f >>> arr unassoc) where assoc ((a,b),c) = (a,(b,c)) unassoc (a,(b,c)) = ((a,b),c) Methods loop :: a (b, d) (c, d) -> a b c Source Instances ArrowLoop (->)   MonadFix m => ArrowLoop ( Kleisli m) Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
https://stdapi.ai/api_reference/
API Reference - stdapi.ai stdapi.ai API Reference Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation API Reference API Reference Back to top Previous Roadmap & Changelog JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://github.com/hone
hone (Terence Lee) · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection Stop leaks before they start EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events & webinars Ebooks & reports Business insights GitHub Skills SUPPORT & SERVICES Documentation Customer support Community forum Trust center Partners Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} hone Follow Overview Repositories 305 Projects 0 Packages 1 Stars 113 More Overview Repositories Projects Packages Stars hone Follow Terence Lee hone Follow Blue Hat League 746 followers · 28 following Heroku Austin, TX http://hone.heroku.com X @hone02 Achievements x2 x3 x3 Achievements x2 x3 x3 Organizations Block or Report Block or report hone --> Block user Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users . You must be logged in to block users. Add an optional note Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you. Block user Report abuse Contact GitHub support about this user’s behavior. Learn more about reporting abuse . Report abuse Overview Repositories 305 Projects 0 Packages 1 Stars 113 More Overview Repositories Projects Packages Stars Popular repositories Loading mruby-cli mruby-cli Public mruby-cli is a platform to build native command line applications for Linux, Windows, and OS X. It provides the tools necessary for building a standalone binary of your application from any machine… Ruby 452 29 heroku-sendgrid-stats heroku-sendgrid-stats Public A Heroku plugin that displays Sendgrid statistics for your Heroku app Ruby 78 4 heroku-buildpack-jsnes heroku-buildpack-jsnes Public Heroku Buildpack for Running JSNES Ruby 18 2 git_pivot git_pivot Public Tool that allows you to work with Pivotal Tracker from the command line Ruby 16 4 resque resque Public Forked from resque/resque Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later. Ruby 14 5 heroku_colorize_console heroku_colorize_console Public Colorize Heroku Console Plugin Ruby 11 4 Something went wrong, please refresh the page to try again. If the problem persists, check the GitHub status page or contact support . Uh oh! There was an error while loading. Please reload this page . Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/mathematics#sidebar
don't count on finding me: mathematics skip to main | skip to sidebar don't count on finding me Showing posts with label mathematics . Show all posts Showing posts with label mathematics . Show all posts Saturday, August 10, 2013 Proudly presenting the »nopetope«! (This is is jotted down, raw posting, that may never get finished. I am publishing it anyway, as it pretty much reflects my current mood.) I am about to do some research with coverings of trees, and it was only natural to look at Baez-Dolan metatrees and the corresponding notion of opetopes. The paper contains a famous 5-minute definition and it is a brain teaser worth reading. They introduce trees and nestings (actually two sides of the same coin) and their superposition, called a constellation, which has to follow some rules, but drawing spheres is a creative process. Then there are zooms which connect constellations as long as the left nesting and the right tree are morally identical. My lambda graphs are basically search trees and a nesting would add the operational notion of evaluation. Since we can freely choose our evaluation strategy (confluence?), the latter corresponds to a nesting. It remains to find out what the degenerate zooms are under this aspect. I am just reading the "Polynomial functors and opetopes" paper (http://arxiv.org/pdf/0706.1033.pdf) and it asserts that it's starting constellation is a one leafed tree: But I wonder if this is fundamental, and since leaves are stripped by zooms, any number will do. So I'll suggest starting with zero leaves, and calling the resulting zoom complex(es) the nopetopes. This might be the first mathematical term I have coined :-) For the mathematically-challenged, a nopetope is just a lollipop wrapped in cellophane, while an opetope is the two-stick version thereof. It is a funny coincidence that "one" and "ope-" contain the same vocals. Going on, we could also have twopetopes and thropetopes, fouretopes etc. But I doubt these are significant in any way. And now back to the paper and then to an Ωmega implementation of nopetopes... PS: while writing this my imagination went though... Are trees and nestings compatible with the famous correspondences energy-mass, wave-particle of physics? Looks like I have to start some more research. Posted by heisenbug at 5:11 AM No comments: Labels: funny , mathematics , opetopes , thrist Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Control-Arrow.html#t:Kleisli
Control.Arrow Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability provisional Maintainer libraries@haskell.org Safe Haskell Trustworthy Control.Arrow Contents Arrows Derived combinators Right-to-left variants Monoid operations Conditionals Arrow application Feedback Description Basic arrow definitions, based on * Generalising Monads to Arrows , by John Hughes, Science of Computer Programming 37, pp67-111, May 2000. plus a couple of definitions ( returnA and loop ) from * A New Notation for Arrows , by Ross Paterson, in ICFP 2001 , Firenze, Italy, pp229-240. These papers and more information on arrows can be found at http://www.haskell.org/arrows/ . Synopsis class Category a => Arrow a where arr :: (b -> c) -> a b c first :: a b c -> a (b, d) (c, d) second :: a b c -> a (d, b) (d, c) (***) :: a b c -> a b' c' -> a (b, b') (c, c') (&&&) :: a b c -> a b c' -> a b (c, c') newtype Kleisli m a b = Kleisli { runKleisli :: a -> m b } returnA :: Arrow a => a b b (^>>) :: Arrow a => (b -> c) -> a c d -> a b d (>>^) :: Arrow a => a b c -> (c -> d) -> a b d (>>>) :: Category cat => cat a b -> cat b c -> cat a c (<<<) :: Category cat => cat b c -> cat a b -> cat a c (<<^) :: Arrow a => a c d -> (b -> c) -> a b d (^<<) :: Arrow a => (c -> d) -> a b c -> a b d class Arrow a => ArrowZero a where zeroArrow :: a b c class ArrowZero a => ArrowPlus a where (<+>) :: a b c -> a b c -> a b c class Arrow a => ArrowChoice a where left :: a b c -> a ( Either b d) ( Either c d) right :: a b c -> a ( Either d b) ( Either d c) (+++) :: a b c -> a b' c' -> a ( Either b b') ( Either c c') (|||) :: a b d -> a c d -> a ( Either b c) d class Arrow a => ArrowApply a where app :: a (a b c, b) c newtype ArrowMonad a b = ArrowMonad (a () b) leftApp :: ArrowApply a => a b c -> a ( Either b d) ( Either c d) class Arrow a => ArrowLoop a where loop :: a (b, d) (c, d) -> a b c Arrows class Category a => Arrow a where Source The basic arrow class. Minimal complete definition: arr and first , satisfying the laws arr id = id arr (f >>> g) = arr f >>> arr g first ( arr f) = arr ( first f) first (f >>> g) = first f >>> first g first f >>> arr fst = arr fst >>> f first f >>> arr ( id *** g) = arr ( id *** g) >>> first f first ( first f) >>> arr assoc = arr assoc >>> first f where assoc ((a,b),c) = (a,(b,c)) The other combinators have sensible default definitions, which may be overridden for efficiency. Methods arr :: (b -> c) -> a b c Source Lift a function to an arrow. first :: a b c -> a (b, d) (c, d) Source Send the first component of the input through the argument arrow, and copy the rest unchanged to the output. second :: a b c -> a (d, b) (d, c) Source A mirror image of first . The default definition may be overridden with a more efficient version if desired. (***) :: a b c -> a b' c' -> a (b, b') (c, c') Source Split the input between the two argument arrows and combine their output. Note that this is in general not a functor. The default definition may be overridden with a more efficient version if desired. (&&&) :: a b c -> a b c' -> a b (c, c') Source Fanout: send the input to both argument arrows and combine their output. The default definition may be overridden with a more efficient version if desired. Instances Arrow (->)   Monad m => Arrow ( Kleisli m)   newtype Kleisli m a b Source Kleisli arrows of a monad. Constructors Kleisli   Fields runKleisli :: a -> m b   Instances Monad m => Category ( Kleisli m)   MonadFix m => ArrowLoop ( Kleisli m) Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class. Monad m => ArrowApply ( Kleisli m)   Monad m => ArrowChoice ( Kleisli m)   MonadPlus m => ArrowPlus ( Kleisli m)   MonadPlus m => ArrowZero ( Kleisli m)   Monad m => Arrow ( Kleisli m)   Derived combinators returnA :: Arrow a => a b b Source The identity arrow, which plays the role of return in arrow notation. (^>>) :: Arrow a => (b -> c) -> a c d -> a b d Source Precomposition with a pure function. (>>^) :: Arrow a => a b c -> (c -> d) -> a b d Source Postcomposition with a pure function. (>>>) :: Category cat => cat a b -> cat b c -> cat a c Source Left-to-right composition (<<<) :: Category cat => cat b c -> cat a b -> cat a c Source Right-to-left composition Right-to-left variants (<<^) :: Arrow a => a c d -> (b -> c) -> a b d Source Precomposition with a pure function (right-to-left variant). (^<<) :: Arrow a => (c -> d) -> a b c -> a b d Source Postcomposition with a pure function (right-to-left variant). Monoid operations class Arrow a => ArrowZero a where Source Methods zeroArrow :: a b c Source Instances MonadPlus m => ArrowZero ( Kleisli m)   class ArrowZero a => ArrowPlus a where Source A monoid on arrows. Methods (<+>) :: a b c -> a b c -> a b c Source An associative operation with identity zeroArrow . Instances MonadPlus m => ArrowPlus ( Kleisli m)   Conditionals class Arrow a => ArrowChoice a where Source Choice, for arrows that support it. This class underlies the if and case constructs in arrow notation. Minimal complete definition: left , satisfying the laws left ( arr f) = arr ( left f) left (f >>> g) = left f >>> left g f >>> arr Left = arr Left >>> left f left f >>> arr ( id +++ g) = arr ( id +++ g) >>> left f left ( left f) >>> arr assocsum = arr assocsum >>> left f where assocsum (Left (Left x)) = Left x assocsum (Left (Right y)) = Right (Left y) assocsum (Right z) = Right (Right z) The other combinators have sensible default definitions, which may be overridden for efficiency. Methods left :: a b c -> a ( Either b d) ( Either c d) Source Feed marked inputs through the argument arrow, passing the rest through unchanged to the output. right :: a b c -> a ( Either d b) ( Either d c) Source A mirror image of left . The default definition may be overridden with a more efficient version if desired. (+++) :: a b c -> a b' c' -> a ( Either b b') ( Either c c') Source Split the input between the two argument arrows, retagging and merging their outputs. Note that this is in general not a functor. The default definition may be overridden with a more efficient version if desired. (|||) :: a b d -> a c d -> a ( Either b c) d Source Fanin: Split the input between the two argument arrows and merge their outputs. The default definition may be overridden with a more efficient version if desired. Instances ArrowChoice (->)   Monad m => ArrowChoice ( Kleisli m)   Arrow application class Arrow a => ArrowApply a where Source Some arrows allow application of arrow inputs to other inputs. Instances should satisfy the following laws: first ( arr (\x -> arr (\y -> (x,y)))) >>> app = id first ( arr (g >>>)) >>> app = second g >>> app first ( arr (>>> h)) >>> app = app >>> h Such arrows are equivalent to monads (see ArrowMonad ). Methods app :: a (a b c, b) c Source Instances ArrowApply (->)   Monad m => ArrowApply ( Kleisli m)   newtype ArrowMonad a b Source The ArrowApply class is equivalent to Monad : any monad gives rise to a Kleisli arrow, and any instance of ArrowApply defines a monad. Constructors ArrowMonad (a () b)   Instances ArrowApply a => Monad ( ArrowMonad a)   Arrow a => Functor ( ArrowMonad a)   ( ArrowApply a, ArrowPlus a) => MonadPlus ( ArrowMonad a)   Arrow a => Applicative ( ArrowMonad a)   ArrowPlus a => Alternative ( ArrowMonad a)   leftApp :: ArrowApply a => a b c -> a ( Either b d) ( Either c d) Source Any instance of ArrowApply can be made into an instance of ArrowChoice by defining left = leftApp . Feedback class Arrow a => ArrowLoop a where Source The loop operator expresses computations in which an output value is fed back as input, although the computation occurs only once. It underlies the rec value recursion construct in arrow notation. loop should satisfy the following laws: extension loop ( arr f) = arr (\ b -> fst ( fix (\ (c,d) -> f (b,d)))) left tightening loop ( first h >>> f) = h >>> loop f right tightening loop (f >>> first h) = loop f >>> h sliding loop (f >>> arr ( id *** k)) = loop ( arr ( id *** k) >>> f) vanishing loop ( loop f) = loop ( arr unassoc >>> f >>> arr assoc) superposing second ( loop f) = loop ( arr assoc >>> second f >>> arr unassoc) where assoc ((a,b),c) = (a,(b,c)) unassoc (a,(b,c)) = ((a,b),c) Methods loop :: a (b, d) (c, d) -> a b c Source Instances ArrowLoop (->)   MonadFix m => ArrowLoop ( Kleisli m) Beware that for many monads (those for which the >>= operation is strict) this instance will not satisfy the right-tightening law required by the ArrowLoop class. Produced by Haddock version 2.13.2
2026-01-13T09:30:24
https://stdapi.ai/use_cases_n8n/
N8N integration - stdapi.ai Skip to content stdapi.ai N8N integration Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration N8N integration Table of contents About N8N Why N8N + stdapi.ai? Prerequisites Quick Start Guide Step 1: Set Up Your Credentials AI Capabilities: Step-by-Step 💬 Chat Completions — Conversational AI 🔊 Text to Speech — Give Your Workflows a Voice 🎤 Speech to Text — Transcribe Audio Effortlessly 🔍 Embeddings — Semantic Search & Intelligence 🎨 Image Generation — Visual Content Creation 🔄 Using Existing OpenAI Templates Migration in 4 Simple Steps 📋 Model Conversion Reference 🎯 Popular Template Categories 🚀 Advanced Workflows Multi-Model Orchestration Self-Hosted N8N Configuration Robust Error Handling 📊 Monitoring & Optimization Performance Best Practices Cost Management 🎓 Next Steps & Resources What You Can Build Now Helpful Resources Get Support ⚠️ Important Considerations IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents About N8N Why N8N + stdapi.ai? Prerequisites Quick Start Guide Step 1: Set Up Your Credentials AI Capabilities: Step-by-Step 💬 Chat Completions — Conversational AI 🔊 Text to Speech — Give Your Workflows a Voice 🎤 Speech to Text — Transcribe Audio Effortlessly 🔍 Embeddings — Semantic Search & Intelligence 🎨 Image Generation — Visual Content Creation 🔄 Using Existing OpenAI Templates Migration in 4 Simple Steps 📋 Model Conversion Reference 🎯 Popular Template Categories 🚀 Advanced Workflows Multi-Model Orchestration Self-Hosted N8N Configuration Robust Error Handling 📊 Monitoring & Optimization Performance Best Practices Cost Management 🎓 Next Steps & Resources What You Can Build Now Helpful Resources Get Support ⚠️ Important Considerations Home Documentation Use cases N8N Integration ¶ Connect N8N automation workflows to Amazon Bedrock models through stdapi.ai's OpenAI-compatible interface. Use any existing OpenAI template from the N8N marketplace without modification—simply point it to your stdapi.ai instance. About N8N ¶ 🔗 Links: Website | GitHub | Documentation | Community N8N is a workflow automation platform: 45,000+ GitHub stars - Open-source workflow automation tool 400+ integrations - Connect with services and APIs Visual workflow builder - No-code interface with customization Self-hosted or cloud - Deploy anywhere AI-native - Built-in nodes for OpenAI and other AI providers Why N8N + stdapi.ai? ¶ Full Compatibility stdapi.ai is fully compatible with N8N's OpenAI nodes. Any workflow, template, or automation designed for OpenAI works with Amazon Bedrock models—no code changes required. Key Benefits: Use familiar OpenAI nodes and templates Access Amazon Bedrock AI models AWS pricing and infrastructure Keep data in your AWS environment Mix different models in the same workflow Work in Progress This integration guide is actively being developed and refined. While the configuration examples are based on documented APIs and best practices, they are pending practical validation. Complete end-to-end deployment examples will be added once testing is finalized. Prerequisites ¶ What You'll Need Before you begin, make sure you have: ✓ A running N8N instance (cloud or self-hosted) ✓ Your stdapi.ai server URL (e.g., https://api.example.com ) ✓ An API key (if authentication is enabled) ✓ AWS access configured with the models you want to use Quick Start Guide ¶ Step 1: Set Up Your Credentials ¶ The foundation of any N8N integration is configuring your API credentials. This one-time setup unlocks all AI capabilities. Creating Your stdapi.ai Credential In your N8N interface: Navigate to Credentials in the left sidebar Click New Credential (or Add Credential ) Search for "OpenAI API" in the credential list Configure the following fields: Credential Name : stdapi.ai (or any name you prefer) API Key : YOUR_STDAPI_KEY Base URL : https://YOUR_SERVER_URL/v1 Click Save to store your credential What This Does By setting a custom Base URL, you redirect all OpenAI API calls to your stdapi.ai instance. N8N will use this credential to authenticate and route requests to Amazon Bedrock models instead of OpenAI's servers. AI Capabilities: Step-by-Step ¶ Now that your credentials are configured, let's explore each AI capability you can use in your N8N workflows. 💬 Chat Completions — Conversational AI ¶ Build intelligent conversational workflows with state-of-the-art language models. Node Configuration Node: OpenAI Chat Model Settings: Parameter Value Description Credential stdapi.ai The credential you created in Step 1 Model Any Bedrock model Enter the model ID for your chosen model Prompt {{ $json.input }} Dynamic content from previous nodes Available Models: All Amazon Bedrock chat models are accessible through N8N once you configure the stdapi.ai credential. This includes: Anthropic Claude — All Claude model variants (Sonnet, Haiku, Opus) Amazon Nova — All Nova family models (Pro, Lite, Micro) Meta Llama — Llama 3 models (if enabled in your AWS region) Mistral AI — Mistral and Mixtral models (if enabled in your AWS region) And more — Any other Bedrock models available in your configured AWS region Example Model IDs: anthropic.claude-sonnet-4-5-20250929-v1:0 — Superior reasoning and code amazon.nova-pro-v1:0 — Advanced reasoning amazon.nova-lite-v1:0 — Balanced performance amazon.nova-micro-v1:0 — Fast, cost-effective responses 💡 Real-World Examples: Customer Support: Automate responses to common customer inquiries with context-aware AI that understands your knowledge base Content Generation: Generate blog posts, product descriptions, email campaigns, and social media content at scale Data Analysis: Extract insights from text data, classify documents, perform sentiment analysis on feedback Code Assistant: Generate, review, and debug code as part of your development workflows 🔊 Text to Speech — Give Your Workflows a Voice ¶ Convert text into natural-sounding audio with Amazon Polly's lifelike voices. Node Configuration Node: OpenAI (Audio → Create Speech) Settings: Parameter Value Description Resource Audio Select the audio resource Operation Create Speech Generate audio from text Credential stdapi.ai Your configured credential Model amazon.polly-standard High-quality standard voices amazon.polly-neural Ultra-realistic neural voices amazon.polly-generative Most natural AI-generated voices amazon.polly-long-form Optimized for long content Voice Joanna , Matthew , Salli Choose from 60+ voices in 30+ languages Input Text {{ $json.message }} The text to synthesize 💡 Real-World Examples: Notifications: Send audio alerts and notifications via phone, smart speakers, or mobile apps Content Creation: Convert blog posts to podcasts, generate audio versions of articles automatically Accessibility: Make your content accessible by providing audio alternatives to text IVR Systems: Generate dynamic voice responses for interactive voice response systems Voice Configuration For Multi-Language Support: Use any OpenAI-compatible voice name (e.g., alloy , echo , nova ) in the Voice parameter. stdapi.ai will automatically detect the language of your text and select an appropriate Amazon Polly voice. For Single-Language Use: If your content is always in the same language, specify a particular Amazon Polly voice for consistent results: English (US): Joanna, Matthew, Salli, Joey, Kendra, Kimberly English (UK): Emma, Brian, Amy Spanish: Lupe, Conchita, Miguel French: Celine, Mathieu German: Marlene, Hans And 50+ more voices in 30+ languages 🎤 Speech to Text — Transcribe Audio Effortlessly ¶ Transform audio recordings into accurate text transcriptions powered by Amazon Transcribe. Node Configuration Node: OpenAI (Audio → Transcribe) Settings: Parameter Value Description Resource Audio Select the audio resource Operation Transcribe Convert speech to text Credential stdapi.ai Your configured credential Model amazon.transcribe Amazon's transcription service Audio File Binary data or file path Supports WAV, MP3, FLAC, OGG Language en-US , es-ES , etc. Optional: improves accuracy 💡 Real-World Examples: Meeting Notes: Automatically transcribe meetings, calls, and interviews for easy review and sharing Customer Service: Convert voicemails and support calls to text for analysis and ticketing systems Media Production: Generate subtitles and captions for videos, podcasts, and webinars Voice Commands: Build voice-controlled automation workflows and smart assistants Language Support Amazon Transcribe supports 35+ languages. Specifying the language code improves accuracy, especially for non-English audio. 🔍 Embeddings — Semantic Search & Intelligence ¶ Generate vector embeddings to power semantic search, recommendations, and RAG (Retrieval-Augmented Generation) systems. Node Configuration Node: Embeddings OpenAI Settings: Parameter Value Description Credential stdapi.ai Your configured credential Model Any embedding model Enter your chosen embedding model ID Input Text {{ $json.document }} Text to convert to vectors Available Embedding Models: The example uses amazon.titan-embed-text-v2:0 , but you can choose from multiple embedding models available in Amazon Bedrock: Amazon Titan Embed Text v2 — amazon.titan-embed-text-v2:0 (recommended, optimized for RAG, 8192 dimensions) Amazon Titan Embed Text v1 — amazon.titan-embed-text-v1 (legacy, 1536 dimensions) Cohere Embed — Cohere embedding models (if enabled in your AWS region) Other providers — Any Bedrock embedding model Choose your embedding model based on: Dimension size — Higher dimensions (like Titan v2's 8192) capture more nuance but use more storage Performance — Some models are faster than others Language support — Ensure your chosen model supports your documents' languages Consistency Important Once you start building workflows with embeddings, stick with the same model. Changing models requires regenerating all embeddings as vectors from different models are not compatible. 💡 Real-World Examples: Semantic Search: Find documents based on meaning rather than exact keyword matches—understand intent, not just words Document Similarity: Compare and cluster documents by semantic similarity for content organization Knowledge Bases: Build RAG systems that retrieve relevant context for AI-powered Q&A Recommendations: Create recommendation engines based on content similarity and user preferences What Are Embeddings? Embeddings convert text into numerical vectors that capture semantic meaning. Similar concepts have similar vectors, enabling AI to understand relationships between documents, even when they use different words. 🎨 Image Generation — Visual Content Creation ¶ Create stunning images from text descriptions using Amazon Bedrock's image generation models. Node Configuration Node: OpenAI (Image → Generate) Settings: Parameter Value Description Resource Image Select the image resource Operation Generate Create image from prompt Credential stdapi.ai Your configured credential Model Any image model Enter your chosen image model ID Prompt Descriptive text Describe the image you want Size Model-dependent Specify dimensions if supported Available Image Models: While the example below uses amazon.nova-canvas-v1:0 , you can use any image generation model available in Amazon Bedrock: Amazon Nova Canvas — amazon.nova-canvas-v1:0 (recommended, fast and high-quality) Stability AI — Stable Diffusion models (if enabled in your AWS region) Other providers — Any Bedrock image generation model Simply specify your preferred model ID in the Model parameter. 💡 Real-World Examples: Marketing Assets: Generate hero images, banners, and visual content for campaigns automatically Product Mockups: Create product visualizations and concept art for rapid prototyping Social Media: Produce eye-catching graphics for posts, stories, and advertisements at scale Blog Illustrations: Generate custom illustrations that match your article content perfectly Prompt Engineering Write detailed prompts for best results. Include style (e.g., "photorealistic," "watercolor"), subject, lighting, and composition details. 🔄 Using Existing OpenAI Templates ¶ The best part? Any N8N workflow or template from the marketplace designed for OpenAI works with stdapi.ai—often with zero modifications needed. Migration in 4 Simple Steps ¶ Quick Migration Guide Step 1: Import the OpenAI template into your N8N instance Step 2: Update all OpenAI nodes to use your stdapi.ai credential Step 3: Replace model names with Amazon Bedrock equivalents (see table below) Step 4: Test and deploy—you're done! 📋 Model Conversion Reference ¶ Use this quick reference to map OpenAI models to Amazon Bedrock equivalents. These are example suggestions —many more models are available depending on your AWS region. OpenAI Model Example stdapi.ai Replacement Use Case gpt-4 anthropic.claude-sonnet-4-5-20250929-v1:0 Complex reasoning, code amazon.nova-pro-v1:0 Advanced analysis Any Claude or advanced model Based on your needs gpt-3.5-turbo amazon.nova-micro-v1:0 Fast, simple tasks amazon.nova-lite-v1:0 Balanced performance Any efficient model Based on your needs whisper-1 amazon.transcribe Speech to text tts-1 amazon.polly-standard Text to speech tts-1-hd amazon.polly-neural or amazon.polly-generative High-quality TTS text-embedding-ada-002 amazon.titan-embed-text-v2:0 Embeddings Any Bedrock embedding model Based on dimensions/language needs dall-e-3 amazon.nova-canvas-v1:0 Image generation Any Bedrock image model Based on style/quality needs Model Selection Tips These are popular starting points, but experiment to find what works best: Speed + Cost → Amazon Nova Micro, or similar fast models Balanced → Amazon Nova Lite, Llama 3, or similar mid-tier models Quality + Reasoning → Claude Sonnet, Nova Pro, or other premium models Specialized Tasks → Explore model-specific strengths (e.g., coding, multilingual, long context) 🎯 Popular Template Categories ¶ stdapi.ai is compatible with N8N templates across these categories: Customer Support & Service AI-powered chatbots and helpdesk automation Ticket classification and routing Sentiment analysis on customer feedback Automated response generation Content & Marketing Blog post and article generation Social media content automation Email campaign personalization SEO content optimization Ad copy generation and A/B testing Data & Analytics Text classification and categorization Entity extraction and data enrichment Report generation and summarization Trend analysis from text data Voice & Audio Meeting transcription pipelines Voice notification systems Podcast production workflows IVR and telephony integration Knowledge & Intelligence Document Q&A systems Knowledge base search and retrieval Intelligent document processing RAG (Retrieval-Augmented Generation) Creative Automation Image generation for marketing Visual content for social media Product mockup automation Brand asset creation 🚀 Advanced Workflows ¶ Multi-Model Orchestration ¶ One of the most powerful features is combining multiple models in a single workflow. Each node can use a different model optimized for its specific task. Smart Content Pipeline 1. Webhook Trigger → Receives article topic 2. Chat Node (amazon.nova-micro-v1:0) → Generate outline quickly 3. Chat Node (anthropic.claude-sonnet-4-5-20250929-v1:0) → Write detailed article 4. Embeddings Node (amazon.titan-embed-text-v2:0) → Create searchable vectors 5. Image Node (amazon.nova-canvas-v1:0) → Generate hero image 6. TTS Node (amazon.polly-neural) → Create audio version Why this works: Each model excels at its specific task—Nova Micro for speed, Claude Sonnet for quality writing, Titan for embeddings, Nova Canvas for images, and Polly for voice. Self-Hosted N8N Configuration ¶ For self-hosted installations, streamline your setup with environment variables: Docker Compose Configuration version : '3.8' services : n8n : image : n8nio/n8n environment : # stdapi.ai defaults - N8N_OPENAI_BASE_URL=https://YOUR_SERVER_URL/v1 - N8N_OPENAI_API_KEY=${STDAPI_KEY} # Other N8N settings - N8N_BASIC_AUTH_ACTIVE=true - N8N_BASIC_AUTH_USER=admin - N8N_BASIC_AUTH_PASSWORD=${ADMIN_PASSWORD} ports : - "5678:5678" volumes : - n8n_data:/home/node/.n8n Environment Variables Setting defaults via environment variables means new workflows automatically use stdapi.ai without manual credential configuration. Robust Error Handling ¶ Build production-ready workflows with proper error handling and resilience. Error Handling Strategy 1. Error Workflows Create a dedicated error workflow that logs failures, sends notifications, and attempts recovery. 2. Retry Logic Use N8N's built-in retry settings for transient errors: Max Retries: 3 Wait Between Retries: 1000ms (exponential backoff) Continue on Fail: Enable for non-critical nodes 3. Fallback Models Implement model fallbacks for critical paths: Primary: anthropic.claude-sonnet-4-5-20250929-v1:0 Fallback: amazon.nova-pro-v1:0 Final Fallback: amazon.nova-lite-v1:0 4. Timeout Configuration Set appropriate timeouts based on operation type: Chat: 30-60 seconds Image generation: 60-120 seconds Transcription: 60-180 seconds (depends on audio length) Embeddings: 10-30 seconds Rate Limits & Quotas Amazon Bedrock has model-specific rate limits and quotas. Monitor your usage and implement backoff strategies for high-volume workflows. Consider requesting quota increases for production deployments. 📊 Monitoring & Optimization ¶ Performance Best Practices ¶ Optimization Checklist ✅ Start Small: Test workflows with limited data before scaling to production ✅ Right-Size Models: Use smaller models (Nova Micro/Lite) for simple tasks—save premium models for complex reasoning ✅ Cache Intelligently: Store embeddings and frequently used results to avoid redundant API calls ✅ Batch Operations: Process multiple items in parallel when possible to reduce total execution time ✅ Monitor Token Usage: Track token consumption in high-volume workflows to optimize costs ✅ Set Execution Limits: Configure max execution time and memory limits to prevent runaway workflows Cost Management ¶ Reduce Your AI Costs Model Selection: Amazon Nova Micro costs significantly less than Claude Sonnet. Use it for simple tasks. Prompt Optimization: Shorter, well-crafted prompts use fewer tokens while maintaining quality. Caching Strategy: Cache embeddings, common responses, and generated images to avoid regeneration. Workflow Efficiency: Eliminate unnecessary AI calls—use conditional logic to skip processing when results are cached. 🎓 Next Steps & Resources ¶ What You Can Build Now ¶ With your stdapi.ai + N8N integration complete, you're ready to: ✨ Import Templates: Browse the N8N marketplace for OpenAI templates and adapt them instantly 🔨 Build Custom Workflows: Combine multiple AI capabilities for unique automation solutions 🔗 Chain Complex Logic: Create sophisticated multi-step AI pipelines with conditional branches 📈 Scale Production: Deploy high-volume workflows with confidence using enterprise-grade infrastructure 🌍 Go Global: Leverage multiple AWS regions for optimal performance worldwide Helpful Resources ¶ Learn More API Overview — Complete list of available models and capabilities Chat Completions API — Detailed chat API documentation Audio APIs — TTS and STT implementation details Configuration Guide — Advanced stdapi.ai configuration options Get Support ¶ Need Help? 💬 Check the N8N community forums for workflow examples 📖 Review Amazon Bedrock documentation for model-specific details 🐛 Report issues on the GitHub repository 🔧 Consult AWS Support for infrastructure and model access questions ⚠️ Important Considerations ¶ Model Availability Regional Differences: Not all Amazon Bedrock models are available in every AWS region. Before building workflows that depend on specific models, verify availability in your configured region. Check your models: See the API Overview for a complete list of supported models by region. API Compatibility OpenAI Compatibility: stdapi.ai implements the OpenAI API specification. Most OpenAI features work seamlessly, but some advanced features (like function calling) may have implementation differences. Test thoroughly: Always test workflows in a development environment before production deployment. Security Best Practices 🔐 Secure Your API Keys: Use N8N's credential manager—never hardcode keys in workflows 🛡️ Enable Authentication: Always require authentication on your stdapi.ai instance 🔒 HTTPS Only: Use HTTPS for all API communications to protect data in transit 📝 Audit Logs: Monitor API usage through AWS CloudTrail and N8N execution logs 👥 Least Privilege: Grant minimal necessary permissions to API keys and service accounts Back to top Previous OpenWebUI integration Next IDE integration (Continue.dev & others) JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://l.facebook.com/l.php?u=https%3A%2F%2Fwww.instagram.com%2F&h=AT1RBcJHaJRv4zmKdqV-ibbXeKvWDx3QxJd9ESulxWXvW0yVDTxYq4ubeMy3lEMinCe657OMhzm4l-52p3A66GlIdGTklqb6HpWOt8ybkQGp8Nve5VLWswwg-r7J5Gy0tflHzrvRHwdUvMvl
Facebook Facebook 이메일 또는 휴대폰 비밀번호 계정을 잊으셨나요? 새 계정 만들기 일시적으로 차단됨 일시적으로 차단됨 회원님의 이 기능 사용 속도가 너무 빠른 것 같습니다. 이 기능 사용에서 일시적으로 차단되었습니다. Back 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch 가입하기 로그인 Messenger Facebook Lite 동영상 Meta Pay Meta 스토어 Meta Quest Ray-Ban Meta Meta AI Meta AI 콘텐츠 더 보기 Instagram Threads 투표 정보 센터 개인정보처리방침 개인정보 보호 센터 정보 광고 만들기 페이지 만들기 개발자 채용 정보 쿠키 AdChoices 이용 약관 고객 센터 연락처 업로드 및 비사용자 설정 활동 로그 Meta © 2026
2026-01-13T09:30:24
https://stdapi.ai/operations_logging_monitoring/
Logging & Monitoring - stdapi.ai Skip to content stdapi.ai Logging & Monitoring Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Logging & Monitoring Table of contents Quick start (2 minutes) Event types Common fields Correlating logs and traces Reading the logs (what to look for) Controlling log verbosity OpenTelemetry integration Example events CloudWatch Logs Insights: ready‑to‑use queries 1) Follow a specific request across request/stream/background 2) Find recent errors with context 3) High-latency endpoints (P95/P99) AWS service-level logs and metrics Troubleshooting checklist Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Quick start (2 minutes) Event types Common fields Correlating logs and traces Reading the logs (what to look for) Controlling log verbosity OpenTelemetry integration Example events CloudWatch Logs Insights: ready‑to‑use queries 1) Follow a specific request across request/stream/background 2) Find recent errors with context 3) High-latency endpoints (P95/P99) AWS service-level logs and metrics Troubleshooting checklist Home Documentation Operations Logging and Monitoring ¶ stdapi.ai provides production observability. It emits structured JSON logs for every request, stream, and background task, and integrates with OpenTelemetry (OTel) for traces and metrics. This guide shows how to enable observability, read the logs, and correlate signals across systems. At a glance JSON logs to STDOUT (perfect for AWS CloudWatch Logs). One event per line. Correlation All events for a request share the same id and are returned as x-request-id . ECS friendly ECS forwards container STDOUT to CloudWatch Logs automatically. Traces (optional) Enable OTEL_ENABLED=true to export spans to X‑Ray, Jaeger, Tempo, etc. Payload logging (optional) Enable LOG_REQUEST_PARAMS=true only for targeted debugging. Quick start (2 minutes) ¶ Set these environment variables, then restart the service (see the Configuration Guide for details): # Set minimum log level (optional, defaults to "info") # Options: info, warning, error, critical, disabled export LOG_LEVEL = warning # Enable OpenTelemetry tracing export OTEL_ENABLED = true export OTEL_SERVICE_NAME = stdapi # 0.0–1.0 (10% example) export OTEL_SAMPLE_RATE = 0 .1 # Include request/response payloads in logs (for debugging ONLY) export LOG_REQUEST_PARAMS = true # Log client IP addresses (requires ENABLE_PROXY_HEADERS for real client IPs) export LOG_CLIENT_IP = true export ENABLE_PROXY_HEADERS = true # When behind ALB/CloudFront Sensitive data and cost impact Enabling LOG_REQUEST_PARAMS may expose sensitive content in logs. Use only in development or during targeted troubleshooting. Redact secrets before sharing logs externally. Additionally, logging full request/response payloads can dramatically increase log volume and costs, especially for large LLM prompts, tool calls, and generated outputs. In AWS CloudWatch Logs, ingestion and storage costs scale with log size. Prefer short retention, targeted sampling, and temporary enablement only when needed. Client IP Logging When LOG_CLIENT_IP=true : The client_ip field is added to request logs The client IP is added as client.address attribute to OpenTelemetry spans (when OTEL_ENABLED=true ) To log the real client IP address (instead of the proxy IP), also enable ENABLE_PROXY_HEADERS=true when running behind AWS ALB, CloudFront, or other reverse proxies. See the Configuration Guide for details. CloudWatch best practice JSON to STDOUT is optimal for CloudWatch Logs Insights. In AWS ECS, the task’s log driver forwards container STDOUT to CloudWatch Logs automatically. Event types ¶ stdapi.ai emits five kinds of JSON events (one per line): Event Description start Emitted once at server startup. Includes startup metadata and warnings. stop Emitted on graceful shutdown. Includes uptime. request One per HTTP request. Method, path, status, timings, and optional request/response. request_stream Streaming segments (SSE/audio). Indicates streaming activity and duration. background Background tasks correlated to the parent request. Common fields ¶ Each event shares core fields and may add type‑specific ones. Field Applies to Description type all One of start , stop , request , request_stream , background level all info , warning , error , critical (controlled by LOG_LEVEL ) date all RFC3339, timezone‑aware timestamp server_id all Instance identifier error_detail all Optional list of formatted exception strings id request, request_stream, background Correlation ID (also returned as x-request-id ) execution_time_ms request, request_stream, background Duration of the handled block method request HTTP method path request Request path status_code request Final HTTP status code client_ip request Client IP address (if LOG_CLIENT_IP=true ) client_user_agent request When provided by client model_id request Targeted model (if applicable) voice_id request TTS voice (if applicable) request_user_id , request_org_id request Propagated identifiers (if applicable) request_params request Sanitized request payload (if LOG_REQUEST_PARAMS=true ) request_response request Sanitized response payload (if LOG_REQUEST_PARAMS=true ) event background Background operation name server_start_time_ms , server_warnings start Startup metrics and warnings server_uptime_ms stop Uptime at shutdown Understanding warnings and errors For request events, default log levels are derived from the final HTTP status: 4xx → warning , 5xx → error . Unexpected server crashes (like HTTP 500) may appear as critical . Authentication/authorization: For security, client responses for 401 and 403 include only generic messages. Full diagnostic details are captured in server logs under error_detail and can be correlated via id (see x-request-id ). server_warnings (on the start event) often highlights missing configuration and features that have been disabled as a result (for example, no S3 bucket configured disables certain image/audio features). error_detail (on any event) contains formatted exception traces and diagnostic hints, which frequently point to missing configuration, unavailable dependencies, or disabled features. Correlating logs and traces ¶ Group events by id to reconstruct a full request lifecycle (request → stream(s) → background). The x-request-id response header exposes the same value so external systems can propagate correlation. With OTel enabled, a root span named like POST /v1/... is created and carries attributes: http.method , http.url , http.user_agent , request.id , server.id , http.status_code , and duration_ms . Do and Don’t for correlation Do propagate x-request-id across client → service → downstreams when possible. Do use request_stream durations to account for total user‑perceived latency. Don’t generate your own request IDs for the same hop; prefer the provided one. Reading the logs (what to look for) ¶ High latency: Inspect execution_time_ms on the request event. If the response was streamed, also sum request_stream durations. Combine with OTel spans to locate downstream delays (model provider, S3, etc.). Errors: Look for level=critical and error_detail (formatted exceptions). With OTel, the span is marked error with attributes error=true and error.message . When to open a GitHub issue If you encounter level=critical events, capture representative JSON log lines (redacting sensitive data) and open an issue at https://github.com/stdapi-ai/stdapi.ai/issues. Include information about the failing request to help reproduce the issue. Payload issues: Temporarily enable LOG_REQUEST_PARAMS=true to validate requests/responses, then disable. Client identification: client_user_agent and optional request_user_id / request_org_id help tie requests to users. Routing confirmation: model_id and voice_id confirm which provider/model/voice handled the request. Controlling log verbosity ¶ The LOG_LEVEL environment variable controls which log events are written to STDOUT. Set it to filter out lower-severity events. For detailed configuration options, see the Logging Level section in the Configuration Guide. info (default): All events are logged (info, warning, error, critical) warning : Only warnings and higher severity (warning, error, critical) - recommended for production error : Only errors and critical events critical : Only critical events disabled : No log output (not recommended) # Production example: reduce log volume while maintaining visibility export LOG_LEVEL = warning Reducing CloudWatch Costs In high-traffic production environments, setting LOG_LEVEL=warning or LOG_LEVEL=error can significantly reduce CloudWatch Logs ingestion and storage costs by filtering out routine info -level events. This is especially effective when combined with appropriate retention policies. Additionally, infrastructure routes are automatically excluded from logging to reduce noise: /docs , /favicon.ico , /health , /openapi.json , /redoc . OpenTelemetry integration ¶ When OTEL_ENABLED=true : A span is created per request and for streaming/background blocks. Spans carry request.id and server.id for correlation. 4xx/5xx status_code marks the span with an error status. Sampling is controlled via OTEL_SAMPLE_RATE . For exporters and advanced setup, rely on standard OTel environment variables supported by your exporter/backend. Example events ¶ Example — Request with payload logging enabled { "type" : "request" , "level" : "info" , "date" : "2025-01-01T12:00:00Z" , "server_id" : "stdapi-1" , "id" : "a1b2c3d4" , "method" : "POST" , "path" : "/v1/chat/completions" , "status_code" : 200 , "model_id" : "anthropic.claude-sonnet-4-5-20250929-v1:0" , "execution_time_ms" : 842 , "request_params" : { "messages" : [{ "role" : "user" , "content" : "..." }]}, "request_response" : { "id" : "cmpl_..." , "choices" : [ ... ], "usage" : { ... }} } Example — Streaming segment (SSE/audio) { "type" : "request_stream" , "level" : "info" , "date" : "2025-01-01T12:00:01Z" , "server_id" : "stdapi-1" , "id" : "a1b2c3d4" , "execution_time_ms" : 1234 } Example — Background work correlated to a request { "type" : "background" , "level" : "info" , "date" : "2025-01-01T12:00:02Z" , "server_id" : "stdapi-1" , "id" : "a1b2c3d4" , "event" : "image-upload-s3" , "execution_time_ms" : 97 } Example — Error with captured details { "type" : "request" , "level" : "critical" , "date" : "2025-01-01T12:00:05Z" , "server_id" : "stdapi-1" , "id" : "e9f0a1b2" , "method" : "POST" , "path" : "/v1/images/edits" , "status_code" : 500 , "error_detail" : [ "Traceback (most recent call last): ..." ], "execution_time_ms" : 12 } CloudWatch Logs Insights: ready‑to‑use queries ¶ These examples assume JSON logs in CloudWatch Logs (default with ECS awslogs/awsfirelens). Adjust the log group and time range. 1) Follow a specific request across request/stream/background ¶ fields @ timestamp , type , level , path , event , status_code , execution_time_ms | filter id = "<paste-request-id>" | sort @ timestamp asc Tip Copy the request ID from the x-request-id response header or any request log line. Expect one request , optional request_stream entries, and background entries. 2) Find recent errors with context ¶ fields @ timestamp , level , type , path , status_code , id , error_detail | filter level in [ "error" , "critical" ] | sort @ timestamp desc | limit 100 3) High-latency endpoints (P95/P99) ¶ fields path , execution_time_ms | filter type = "request" and ispresent ( execution_time_ms ) | stats pct ( execution_time_ms , 95 ) as p95_ms , pct ( execution_time_ms , 99 ) as p99_ms , avg ( execution_time_ms ) as avg_ms by path | sort p95_ms desc AWS service-level logs and metrics ¶ Beyond stdapi.ai logs and OTel traces, use AWS-native signals from the underlying AI services to validate provider behavior, monitor throttling/latency, and audit access. Enable only what you need: some options can capture content and increase costs. For full, up-to-date details, refer to the official AWS documentation for more information. CloudWatch Metrics: Throughput, latency, throttling, and error rates per service/region. CloudTrail: Control-plane auditing of API calls (who did what, when, from where). Content/Invocation logging: Optional features that may record inputs/outputs. Use with caution and encryption/retention controls. Correlation: Service logs won’t include StdAPI x-request-id . Correlate by time window, region, model/voice/job identifiers, and volume. Use StdAPI model_id , voice_id , and execution_time_ms to narrow windows. AWS Bedrock Invocation logging (optional): Export invocation metadata and, if enabled, content to CloudWatch Logs/S3/Firehose. Treat prompts/completions as sensitive; manage retention and KMS. Troubleshooting checklist ¶ No logs visible: Ensure you are reading container STDOUT. On ECS/Kubernetes, verify the log driver and retention. Missing request_params : Confirm LOG_REQUEST_PARAMS=true and restart after changing environment variables. No traces: Verify OTEL_ENABLED=true and that exporters are configured and reachable. Correlation missed: Ensure clients read and propagate x-request-id for multi‑hop requests. Back to top Previous Licensing Next Overview JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/mathematics#main
don't count on finding me: mathematics skip to main | skip to sidebar don't count on finding me Showing posts with label mathematics . Show all posts Showing posts with label mathematics . Show all posts Saturday, August 10, 2013 Proudly presenting the »nopetope«! (This is is jotted down, raw posting, that may never get finished. I am publishing it anyway, as it pretty much reflects my current mood.) I am about to do some research with coverings of trees, and it was only natural to look at Baez-Dolan metatrees and the corresponding notion of opetopes. The paper contains a famous 5-minute definition and it is a brain teaser worth reading. They introduce trees and nestings (actually two sides of the same coin) and their superposition, called a constellation, which has to follow some rules, but drawing spheres is a creative process. Then there are zooms which connect constellations as long as the left nesting and the right tree are morally identical. My lambda graphs are basically search trees and a nesting would add the operational notion of evaluation. Since we can freely choose our evaluation strategy (confluence?), the latter corresponds to a nesting. It remains to find out what the degenerate zooms are under this aspect. I am just reading the "Polynomial functors and opetopes" paper (http://arxiv.org/pdf/0706.1033.pdf) and it asserts that it's starting constellation is a one leafed tree: But I wonder if this is fundamental, and since leaves are stripped by zooms, any number will do. So I'll suggest starting with zero leaves, and calling the resulting zoom complex(es) the nopetopes. This might be the first mathematical term I have coined :-) For the mathematically-challenged, a nopetope is just a lollipop wrapped in cellophane, while an opetope is the two-stick version thereof. It is a funny coincidence that "one" and "ope-" contain the same vocals. Going on, we could also have twopetopes and thropetopes, fouretopes etc. But I doubt these are significant in any way. And now back to the paper and then to an Ωmega implementation of nopetopes... PS: while writing this my imagination went though... Are trees and nestings compatible with the famous correspondences energy-mass, wave-particle of physics? Looks like I have to start some more research. Posted by heisenbug at 5:11 AM No comments: Labels: funny , mathematics , opetopes , thrist Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
https://docs.asciidoctor.org/
Asciidoctor Documentation Site Asciidoctor Docs AsciiDoc Language Syntax Quick Reference Processing Asciidoctor Ruby Asciidoctor.js JavaScript AsciidoctorJ Java Extensions Add-on Converters PDF Ruby EPUB3 Ruby reveal.js Ruby, JavaScript Source Compilers Reducer Ruby, JavaScript Extended Syntax Asciidoctor Diagram Ruby Tooling Build Automation Maven Tools Java Gradle Plugin Java Asciidoclet Java Text Editors / Viewers Browser Extension IntelliJ Plugin Chat List --> Source Tweets Explore AsciiDoc Asciidoctor 2.0 Asciidoctor.js 3.0 2.2 AsciidoctorJ 3.0 2.5 Asciidoctor PDF 2.3 2.2 2.1 2.0 Asciidoctor EPUB3 2.3 Asciidoctor reveal.js 5.0 4.1 Maven Tools 3.2 Gradle Plugin Suite 5.0 4.0 Asciidoclet 2.0 1.5.6 Asciidoctor Diagram 3.0.1 Browser Extension Community Explore Home Edit this Page Asciidoctor Documentation Site Welcome to the Asciidoctor documentation site! Here you can find the reference material, guides, and examples to write content in AsciiDoc and publish it using Asciidoctor. This documentation will help you start your journey with AsciiDoc or dive deeper if you’re already well on your way. Learn about AsciiDoc AsciiDoc is a plain text authoring format (i.e., lightweight markup language) for writing technical content such as documentation, articles, and books. If you’re just starting out with AsciiDoc, or want to discover what it’s all about, head over to the documentation for the AsciiDoc Language . You’ll learn everything from how to make your first AsciiDoc document to how to use advanced language features such as list continuations and tailoring substitutions. If you need a condensed refresher, or want a glimpse of what AsciiDoc has to offer, check out the syntax quick reference . You can also find a side-by-side comparison with Markdown if you’re looking to upgrade. Process your AsciiDoc content The AsciiDoc language documentation is primarily about the source you type to compose a document. Once you’re done writing and want to publish your AsciiDoc document, you’ll need an AsciiDoc processor. That’s where Asciidoctor fits in. Asciidoctor is the core AsciiDoc processor. It reads the AsciiDoc source, parses it into a document model, and converts it to a publishable format such as HTML using a converter. Asciidoctor has both a CLI and an API that you can use to invoke a built-in converter (HTML, DocBook, man page) or an add-on converter. Asciidoctor enriches the HTML it produces from AsciiDoc by applying a default stylesheet , adding stylistic icons, and syntax highlighting source blocks. Choose a processor There are three variants of the core Asciidoctor processor that all share the same code base. With few exceptions, these variants all provide the full Asciidoctor experience. From these three implementations extend a host of extensions, build tool integrations, and tooling plugins in the Asciidoctor community and beyond. Choose the one that best suits the language platform you’re using. Asciidoctor Ruby The original code base enables you to run Asciidoctor using any Ruby implementation, including C Ruby, JRuby, and TruffleRuby. JRuby and TruffleRuby allow you to use Asciidoctor on a JVM. Asciidoctor.js JavaScript Transpiles Asciidoctor into JavaScript so you can run it in the browser or a Node.js application. It provides a CLI as well as a porcelain API for methods in the Asciidoctor document model and even enables you to write Asciidoctor extensions in JavaScript. AsciidoctorJ Java/JVM A Java library that encapsulates the use of JRuby to load and run Asciidoctor on the JVM. It provides a CLI as well as native Java API wrappers for all of the Asciidoctor APIs and even enables you to write Asciidoctor extensions in Java. Explore Asciidoctor Build automation Convert your content from AsciiDoc automatically when you run your build. Encapsulate assets, configuration profiles, and extensions for your publishing process in your build scripts. Even extract and convert AsciiDoc inside Javadoc comments or include snippets from your test suite. Maven tools Asciidoclet (for Javadoc) Extensions Author HTML slide presentations in AsciiDoc without having to wrestle with the clutter of HTML or add diagrams to the output file that are generated from plain text markup inside your AsciiDoc document using extensions. The possiblities are boundless! reveal.js converter Diagram extension Site generation Want to build a documentation site like this one? Write the content for the site in AsciiDoc. A static site generator delegates to an AsciiDoc processor to convert the AsciiDoc files to embedded HTML, then applies a template to that HTML to generate pages for the site. Antora Essential reference Keep this essential reference material for writing and publishing content with AsciiDoc and Asciidoctor close at hand. AsciiDoc syntax quick reference Document attributes CLI reference API reference How to search the docs On any page, you can press s or Ctrl + / to focus the search box. Enter one or more terms (i.e., a query) to search the documentation. Alternately, you can press Ctrl + < (i.e., Ctrl + Shift + , on a US keyboard) to restore the previous search. As you type your query, the search results will be displayed in a panel immediately below the search box. You can browse the list of search results and navigate to a result using either the mouse or the keyboard. To navigate to a result in the current tab using the mouse, hover over it with the mouse cursor and click on it using the left mouse button. If you want to keep the search results open while you’re looking for the best result, you can open the result in a new tab. To open a result in a new tab, either hold down Ctrl when you click the result, or right click on it and select "Open link in new tab". To clear the search, click anywhere outside of the panel of search results. To navigate to a result using the keyboard, first use the up and down arrow keys to choose a result. This action will highlight the current result with a light blue selection box. You can then press Enter when the result is highlighted to navigate to that result in the current tab. To open a result in a new tab, press Ctrl + Enter instead. To clear the search, press Esc . The search will look for results using fuzzy matching. That means it will locate pages with words or phrases that are close to what you entered, but not exactly. This strategy helps bridge the gap between your terminology or phrasing with that used in the documentation. If you want to look for an exact match, enclose the query in double quotes (e.g., "the details of the syntax" ). You can also quote individual terms to disable the typo tolerance (e.g., "toc" position ). This strategy helps you to find exactly what you’re looking for with no false positives. However, it will yield less results. Another way to narrow the results is to prefix one or more terms with - (e.g., -document ). Adding this prefix will exclude results that contain that term. By default, the search looks for results across the whole documentation site. If you want to limit the scope of the search to the documentation for the version of the project you’re currently looking at, tick the "In this project" checkbox. You can toggle this checkbox when the search results are open to compare the results for the whole site with those for the current project version. Asciidoctor Home --> Docs Chat Source List (archive) @asciidoctor Copyright © 2026 Dan Allen, Sarah White, and individual Asciidoctor contributors. Except where noted, the content is licensed under a Creative Commons Attribution 4.0 International (CC BY 4.0) license. The UI for this site is derived from the Antora default UI and is licensed under the MPL-2.0 license. Several icons are imported from Octicons and are licensed under the MIT license. AsciiDoc® and AsciiDoc Language™ are trademarks of the Eclipse Foundation, Inc. Thanks to our backers and contributors for helping to make this project possible. Additional thanks to: Authored in AsciiDoc . Produced by Antora and Asciidoctor .
2026-01-13T09:30:24
https://hackage.haskell.org
Introduction | Hackage Hackage :: [Package] Search  Browse What's new Upload User accounts Hackage: The Haskell Package Repository Hackage is the Haskell community's central package archive of open source software. Hackage has been online since January 2007 and is constantly growing. You can publish libraries and programs or download and install packages with tools like cabal-install (or via your distro's package manager). Package Downloads Browse packages Search packages Recent uploads Supplementary views: Packages by category Tags All packages with reverse dependencies --> All packages by download --> Deprecated packages Candidate packages Preferred and deprecated version information Package Uploads Register an account Upload a package Guidelines for Hackage Packages: Hackage accepts uploads of Cabal packages Packages must be in the standard compressed tarball form produced by Cabal's sdist command. Packages cannot be deleted , so you should consider uploading new package versions as package candidates and testing before publishing to the main index. All curated packages should follow the Package Versioning Policy (PVP) . Packages uploads may opt-out of curation through use of the x-curation field Please consult the documentation for uploading packages for more in-depth information about Hackage's policies, including the usage of the x-curation field. Administrative issues Taking over a package Abandoning a package Hackage trustees and what they do Submitting changes for the base library Reporting problems For issues with accounts or permissions please contact the administrators by email at hackage-admin@haskell.org Bugs with the site code or server/hosting issues should be reported in the issue tracker . Scheduled infrastructure status information is available at status.haskell.org and automated uptime information at auto-status.haskell.org . Serious issues requiring immediate action should be reported to admin@haskell.org or on the #haskell-infrastructure irc channel on libera.chat. The Hackage API Hackage serves most resources in JSON as well as HTML. It also provides automatically-generated documentation of the site api . Core operations of clients interacting with hackage as a repository should be conducted through the hackage-security library. Contributing to development Hackage-server is on github and we welcome contributions including pull requests, bug reports, and feature requests. Developer documentation is on in the github README, includig a quick guide to running your own server instance, and mirroring the central server. You can ask questions on the cabal-devel mailing list or on IRC in the #hackage channel on libera.chat. Credits The current Hackage codebase was spearheaded by Well-Typed . The website is maintained by volunteers from the Haskell community, with support from the Haskell Foundation . Hosting is provided by DigitalOcean and real-time CDN by Fastly .
2026-01-13T09:30:24
https://stdapi.ai/use_cases_note_taking/
Note-taking apps (Obsidian & Notion) - stdapi.ai Skip to content stdapi.ai Note-taking apps (Obsidian & Notion) Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Note-taking apps (Obsidian & Notion) Table of contents About Note-Taking AI Integrations Obsidian AI Plugins Notion AI Integrations Other Note-Taking Tools Why Note-Taking AI + stdapi.ai? 📝 Obsidian Integration Text Generator Plugin Smart Connections Plugin Copilot Plugin 📓 Notion Integration Method 1: API + Custom Scripts Method 2: Automation Platforms 💡 Common Use Cases 📝 Writing Enhancement 🔍 Knowledge Discovery 📊 Content Structuring 🌐 Translation & Localization 📊 Model Recommendations 💡 Best Practices 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents About Note-Taking AI Integrations Obsidian AI Plugins Notion AI Integrations Other Note-Taking Tools Why Note-Taking AI + stdapi.ai? 📝 Obsidian Integration Text Generator Plugin Smart Connections Plugin Copilot Plugin 📓 Notion Integration Method 1: API + Custom Scripts Method 2: Automation Platforms 💡 Common Use Cases 📝 Writing Enhancement 🔍 Knowledge Discovery 📊 Content Structuring 🌐 Translation & Localization 📊 Model Recommendations 💡 Best Practices 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Home Documentation Use cases Note-Taking Apps — Obsidian & Notion AI ¶ Enhance your note-taking and knowledge management with AI-powered features using Amazon Bedrock models through stdapi.ai. Integrate AI assistance directly into Obsidian, Notion, and other note-taking applications for intelligent writing, summarization, and knowledge discovery. About Note-Taking AI Integrations ¶ Many popular note-taking applications support AI plugins that use OpenAI's API, making them perfect candidates for stdapi.ai integration. This guide covers the most popular tools and their AI extensions. Obsidian AI Plugins ¶ 🔗 Obsidian: Website | Community Plugins | Forum Popular AI plugins for Obsidian: Text Generator — GPT-powered text generation in notes Smart Connections — AI-powered note linking and semantic search Copilot — ChatGPT interface within Obsidian BMO Chatbot — Versatile AI assistant for notes Notion AI Integrations ¶ 🔗 Notion: Website | API Docs AI integration approaches for Notion: Notion AI API Wrappers — Custom integrations using Notion's API Browser Extensions — Third-party extensions that add AI features Zapier/Make.com — Workflow automation with AI processing Custom Scripts — Python/JavaScript scripts using Notion API + OpenAI-compatible APIs Other Note-Taking Tools ¶ Logseq — Open-source knowledge base with AI plugin support Roam Research — Network note-taking with API access Joplin — Open-source with plugin ecosystem Why Note-Taking AI + stdapi.ai? ¶ AI-Powered Knowledge Management Turn your notes into an intelligent knowledge base with AI assistance using Amazon Bedrock models instead of OpenAI. Key Benefits: Privacy - Your notes and thoughts stay in your AWS environment Access Claude Sonnet and other Bedrock models for writing and reasoning AWS pricing for high-volume note processing Choose models optimized for different tasks Use open-source tools with your own infrastructure Work in Progress This integration guide is actively being developed and refined. While the configuration examples are based on documented APIs and best practices, they are pending practical validation. Complete end-to-end deployment examples will be added once testing is finalized. 📝 Obsidian Integration ¶ Text Generator Plugin ¶ The Text Generator plugin is the most popular AI plugin for Obsidian, with extensive customization options. Installation: Open Obsidian Settings Navigate to Community plugins → Browse Search for "Text Generator" Install and enable the plugin Configuration: Text Generator Settings Open Settings → Text Generator Under Provider , select OpenAI Configure the following: API Provider : OpenAI API Key : your_stdapi_key_here Base URL : https://YOUR_SERVER_URL/v1 Model : anthropic.claude-sonnet-4-5-20250929-v1:0 Temperature : 0.7 Max Tokens : 4000 Available Models: Use any Amazon Bedrock chat model. Popular choices include Claude Sonnet (best for writing), Claude Haiku (fast responses), Amazon Nova Pro (long context), and Amazon Nova Lite (balanced). Use Cases: Writing Assistant: Generate, expand, or rewrite note content Summarization: Condense long notes into key points Note Templates: Auto-generate structured notes from prompts Translation: Translate notes between languages Formatting: Convert content between formats (bullet points, paragraphs, tables) Smart Connections Plugin ¶ Enable semantic search and AI-powered note discovery using embeddings. Installation & Configuration: Smart Connections Settings Install the Smart Connections plugin from Community plugins Open Settings → Smart Connections Configure: Embedding Provider : OpenAI API Key : your_stdapi_key_here Base URL : https://YOUR_SERVER_URL/v1 Embedding Model : amazon.titan-embed-text-v2:0 Chat Provider : OpenAI Chat API Key : your_stdapi_key_here Chat Base URL : https://YOUR_SERVER_URL/v1 Chat Model : anthropic.claude-sonnet-4-5-20250929-v1:0 Available Embedding Models: Amazon Titan Embed Text v2 — amazon.titan-embed-text-v2:0 (recommended, 8192 dimensions) Amazon Titan Embed Text v1 — amazon.titan-embed-text-v1 (legacy, 1536 dimensions) Cohere Embed — If enabled in your AWS region Use Cases: Semantic Search: Find related notes by meaning, not just keywords Auto-Linking: Discover connections between notes automatically Context-Aware Chat: Ask questions about your entire knowledge base Similar Notes: Find notes with similar themes or topics Copilot Plugin ¶ Chat with AI directly in Obsidian with a ChatGPT-like interface. Configuration: Copilot Settings API Provider : OpenAI API Key : your_stdapi_key_here API URL : https://YOUR_SERVER_URL/v1 Default Model : anthropic.claude-sonnet-4-5-20250929-v1:0 Features: Chat Interface: Sidebar chat window for AI conversations Note Context: Include current note or vault content in chat Command Palette: Quick AI actions via Obsidian commands Custom Prompts: Save frequently used prompts 📓 Notion Integration ¶ Notion doesn't have official plugin support, but you can integrate AI through various methods. Method 1: API + Custom Scripts ¶ Build custom AI features using Notion's API and stdapi.ai. Python Script Example import os from notion_client import Client from openai import OpenAI # Initialize Notion client notion = Client ( auth = os . environ [ "NOTION_TOKEN" ]) # Initialize OpenAI client with stdapi.ai client = OpenAI ( api_key = os . environ [ "STDAPI_KEY" ], base_url = "https://YOUR_SERVER_URL/v1" ) def summarize_page ( page_id ): # Get page content from Notion page = notion . blocks . children . list ( block_id = page_id ) # Extract text content content = extract_text ( page ) # Summarize with AI response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : f "Summarize this note: \n\n { content } " }] ) # Add summary back to Notion summary = response . choices [ 0 ] . message . content notion . blocks . children . append ( block_id = page_id , children = [{ "object" : "block" , "type" : "callout" , "callout" : { "rich_text" : [{ "type" : "text" , "text" : { "content" : summary }}], "icon" : { "emoji" : "💡" } } }] ) Use Cases: Auto-Summarization: Add AI summaries to long pages Content Generation: Generate page templates from prompts Batch Processing: Process multiple pages with AI Automated Tagging: AI-powered page categorization Method 2: Automation Platforms ¶ Use workflow automation tools to connect Notion with AI. Make.com/Zapier Integration Trigger: New page in Notion database Action: HTTP Request to stdapi.ai { "url" : "https://YOUR_SERVER_URL/v1/chat/completions" , "method" : "POST" , "headers" : { "Authorization" : "Bearer YOUR_STDAPI_KEY" , "Content-Type" : "application/json" }, "body" : { "model" : "anthropic.claude-sonnet-4-5-20250929-v1:0" , "messages" : [ { "role" : "user" , "content" : "{{notion_page_content}}" } ] } } Action: Update Notion page with AI response 💡 Common Use Cases ¶ 📝 Writing Enhancement ¶ Use AI to improve your writing: Expand Ideas: Turn bullet points into full paragraphs Rewrite: Improve clarity, tone, or style Proofread: Grammar, spelling, and style corrections Simplify: Make complex topics more accessible Example Prompts "Expand these bullet points into a detailed explanation" "Rewrite this paragraph to be more concise" "Fix grammar and improve clarity in this note" "Explain this concept as if teaching a beginner" 🔍 Knowledge Discovery ¶ Unlock insights from your notes: Semantic Search: Find related notes by meaning Auto-Tagging: Generate relevant tags from content Connection Discovery: Find unexpected links between notes Trend Analysis: Identify recurring themes in your knowledge base 📊 Content Structuring ¶ Organize information effectively: Outline Generation: Create structured outlines from rough notes Table Creation: Convert lists into formatted tables Categorization: Automatically organize notes by topic Template Creation: Generate reusable note templates 🌐 Translation & Localization ¶ Work across languages: Note Translation: Convert notes between languages Multilingual Search: Find notes in any language Learning Support: Translate foreign language content 📊 Model Recommendations ¶ Choose models based on your note-taking needs. These are examples —all Bedrock models are available. Task Example Model Why Writing & Editing anthropic.claude-sonnet-4-5-20250929-v1:0 Superior language understanding and generation Quick Summaries amazon.nova-lite-v1:0 Fast, cost-effective for frequent use Long Notes amazon.nova-pro-v1:0 Large context window (300K tokens) Semantic Search amazon.titan-embed-text-v2:0 High-quality embeddings for note linking Batch Processing amazon.nova-micro-v1:0 Efficient for processing many notes 💡 Best Practices ¶ Privacy & Security Local-First: Keep sensitive notes local and process only non-sensitive content with AI Encryption: Use Obsidian's encrypted vaults for sensitive information API Keys: Store API keys securely, never in note content Review Output: Always review AI-generated content before saving Efficient Usage Batch Operations: Process multiple notes at once to save API calls Template Reuse: Create templates for common AI tasks Selective Processing: Use AI only where it adds value, not for everything Cache Results: Save AI outputs to avoid regenerating the same content Quality Optimization Clear Prompts: Specific instructions produce better results Iterative Refinement: Use follow-up prompts to improve output Context Matters: Provide relevant context for better AI understanding Model Selection: Use premium models for important content, efficient models for quick tasks 🚀 Next Steps & Resources ¶ Getting Started ¶ Choose Your Tool: Start with Obsidian if you want full control, Notion for collaboration Install Plugins: Set up Text Generator or Smart Connections in Obsidian Configure stdapi.ai: Add your API credentials and model preferences Create Templates: Build reusable prompts for common tasks Experiment: Try different models and prompts to find what works best Learn More ¶ Additional Resources Obsidian Plugin Development — Create custom AI plugins Notion API Documentation — Build Notion integrations API Overview — Complete list of available Bedrock models Chat Completions API — Detailed API documentation Community & Support ¶ Need Help? 💬 Join the Obsidian Discord for plugin support 💬 Join the Notion Community for integration discussions 📖 Review Amazon Bedrock documentation for model-specific details 🐛 Report issues on the GitHub repository ⚠️ Important Considerations ¶ Model Availability Regional Differences: Not all Amazon Bedrock models are available in every AWS region. Verify model availability before configuring plugins. Check availability: See the API Overview for supported models by region. Plugin Compatibility Plugin Updates: AI plugins are updated frequently—configuration options may change Version Check: Ensure your plugins support custom API endpoints Testing: Always test with non-critical notes first Cost Management Token Usage: Long notes consume more tokens—summarize or chunk content when possible Embedding Costs: Initial vault indexing can be expensive—use incrementally Model Selection: Use efficient models for frequent operations Batch Processing: Process multiple notes in one session to reduce overhead Back to top Previous LangChain / LlamaIndex integration Next Chat bots (Slack, Discord & Teams) JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://rubygems.org/gems/rodauth
rodauth | RubyGems.org | your community gem host ⬢ RubyGems nav#focus mousedown->nav#mouseDown click@window->nav#hide"> Navigation menu autocomplete#choose mouseover->autocomplete#highlight"> Search Gems… Releases Blog Gems Guides Sign in Sign up rodauth 2.42.0 Rodauth is Ruby's most advanced authentication framework, designed to work in all rack applications. It's built using Roda and Sequel, but it can be used as middleware in front of web applications that use other web frameworks and database libraries. Rodauth aims to provide strong security for password storage by utilizing separate database accounts if possible on PostgreSQL, MySQL, and Microsoft SQL Server. Configuration is done via a DSL that makes it easy to override any part of the authentication process. Rodauth supports typical authentication features: such as login and logout, changing logins and passwords, and creating, verifying, unlocking, and resetting passwords for accounts. Rodauth also supports many advanced authentication features: * Secure password storage using security definer database functions * Multiple primary multifactor authentication methods (WebAuthn and TOTP), as well as backup multifactor authentication methods (SMS and recovery codes). * Passwordless authentication using email links and WebAuthn authenticators. * Both standard HTML form and JSON API support for all features. Gemfile: = install: = Versions: 2.42.0 December 18, 2025 (105 KB) 2.41.0 October 08, 2025 (105 KB) 2.40.0 August 22, 2025 (105 KB) 2.39.0 May 22, 2025 (105 KB) 2.38.0 January 15, 2025 (104 KB) Show all versions (72 total) Runtime Dependencies (2): roda >= 2.6.0 sequel >= 4 Development Dependencies (13): argon2 >= 2 bcrypt >= 0 capybara >= 2.1.0 jwt >= 0 mail >= 0 minitest >= 5.0.0 minitest-global_expectations >= 0 minitest-hooks >= 1.1.0 rack_csrf >= 0 rotp >= 0 rqrcode >= 0 tilt >= 0 webauthn >= 2 Show all transitive dependencies Owners: Pushed by: Authors: Jeremy Evans SHA 256 checksum: = ← Previous version Total downloads 710,068 For this version 4,008 Version Released: December 18, 2025 8:31pm License: MIT Required Ruby Version: >= 1.9.2 Links: Homepage Changelog Source Code Documentation Mailing List Bug Tracker Download Review changes Badge Subscribe RSS Report abuse Reverse dependencies Status Uptime Code Data Stats Contribute About Help API Policies Support Us Security RubyGems.org is the Ruby community’s gem hosting service. Instantly publish your gems and then install them . Use the API to find out more about available gems . Become a contributor and improve the site yourself. The RubyGems.org website and service are maintained and operated by Ruby Central’s Open Source Program and the RubyGems team. It is funded by the greater Ruby community through support from sponsors, members, and infrastructure donations. If you build with Ruby and believe in our mission, you can join us in keeping RubyGems.org, RubyGems, and Bundler secure and sustainable for years to come by contributing here . Operated by Ruby Central Designed by DockYard Hosted by AWS Resolved with DNSimple Monitored by Datadog Gems served by Fastly Monitored by Honeybadger Secured by Mend.io English Nederlands 简体中文 正體中文 Português do Brasil Français Español Deutsch 日本語
2026-01-13T09:30:24
https://stdapi.ai/use_cases_librechat/
LibreChat integration - stdapi.ai Skip to content stdapi.ai LibreChat integration Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LibreChat integration Table of contents About LibreChat Why LibreChat + stdapi.ai? Prerequisites 🚀 Quick Start with Docker Step 1: Clone LibreChat Repository Step 2: Configure stdapi.ai Connection Step 3: Configure Available Models Step 4: Enable Additional Features Step 5: Deploy with Docker Compose 🎯 What You Can Do Now 💬 Conversational AI 🎨 Multi-Modal Capabilities 👥 Team Collaboration ⚙️ Customization 🔧 Advanced Configuration User Registration and Authentication RAG and Document Intelligence Production Deployment 📊 Model Recommendations 💡 Pro Tips & Best Practices 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents About LibreChat Why LibreChat + stdapi.ai? Prerequisites 🚀 Quick Start with Docker Step 1: Clone LibreChat Repository Step 2: Configure stdapi.ai Connection Step 3: Configure Available Models Step 4: Enable Additional Features Step 5: Deploy with Docker Compose 🎯 What You Can Do Now 💬 Conversational AI 🎨 Multi-Modal Capabilities 👥 Team Collaboration ⚙️ Customization 🔧 Advanced Configuration User Registration and Authentication RAG and Document Intelligence Production Deployment 📊 Model Recommendations 💡 Pro Tips & Best Practices 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Home Documentation Use cases LibreChat Integration ¶ Connect LibreChat to Amazon Bedrock models through stdapi.ai. Deploy a self-hosted ChatGPT alternative with multi-user support, conversation management, and access to Claude, Amazon Nova, and other Bedrock models. About LibreChat ¶ 🔗 Links: Website | GitHub | Documentation | Discord LibreChat is a feature-rich, open-source AI chat platform with: 30,000+ GitHub stars - Popular open-source ChatGPT alternative Production-ready - Used by organizations worldwide Multi-modal - Chat, voice, images, and document analysis Extensible - Plugin system, custom endpoints, and integrations Why LibreChat + stdapi.ai? ¶ Enterprise ChatGPT Alternative LibreChat is designed for teams and organizations needing a private, customizable AI assistant. With stdapi.ai, you get the familiar ChatGPT experience backed by Amazon Bedrock's enterprise-grade models—all within your own infrastructure. Key Benefits: Multi-user platform - Team collaboration with individual accounts and conversations Privacy - Your conversations and data stay in your infrastructure Enterprise models - Access Claude, Amazon Nova, and all Bedrock models Rich features - Conversation history, presets, plugins, file uploads Cost control - AWS pricing with usage tracking and quotas Customizable - White-label, branding, and custom configurations Active development - Regular updates with new features Work in Progress This integration guide is actively being developed and refined. While the configuration examples are based on documented APIs and best practices, they are pending practical validation. Complete end-to-end deployment examples will be added once testing is finalized. Prerequisites ¶ What You'll Need Before you begin, make sure you have: ✓ Docker and Docker Compose installed (or Kubernetes for production) ✓ Your stdapi.ai server URL (e.g., https://api.example.com ) ✓ An API key (if authentication is enabled) ✓ AWS Bedrock access configured with desired models ✓ (Optional) MongoDB for conversation storage ✓ (Optional) Domain name and SSL certificate for production 🚀 Quick Start with Docker ¶ Step 1: Clone LibreChat Repository ¶ Get the latest version of LibreChat from GitHub. Clone and Setup # Clone the repository git clone https://github.com/danny-avila/LibreChat.git cd LibreChat # Copy the example environment file cp .env.example .env Step 2: Configure stdapi.ai Connection ¶ Edit the .env file to configure LibreChat to use stdapi.ai as the OpenAI provider. .env Configuration # Core LibreChat settings HOST = 0 .0.0.0 PORT = 3080 # MongoDB (required for conversation storage) MONGO_URI = mongodb://mongodb:27017/LibreChat # Session secret (generate a random string) SESSION_SECRET = your_random_session_secret_here # stdapi.ai as OpenAI provider OPENAI_API_KEY = your_stdapi_key_here OPENAI_REVERSE_PROXY = https://YOUR_SERVER_URL/v1 # Optional: Enable all features DEBUG_OPENAI = true Generate Session Secret Generate a secure session secret: openssl rand -base64 32 Step 3: Configure Available Models ¶ Create a librechat.yaml configuration file to define which Bedrock models are available to users. librechat.yaml - Model Configuration version : 1.0.5 cache : true endpoints : custom : - name : "Amazon Bedrock" apiKey : "${OPENAI_API_KEY}" baseURL : "https://YOUR_SERVER_URL/v1" models : default : - "anthropic.claude-sonnet-4-5-20250929-v1:0" - "anthropic.claude-3-5-haiku-20241022-v1:0" - "amazon.nova-pro-v1:0" - "amazon.nova-lite-v1:0" - "amazon.nova-micro-v1:0" fetch : false titleConvo : true titleModel : "amazon.nova-micro-v1:0" summarize : false summaryModel : "amazon.nova-lite-v1:0" forcePrompt : false modelDisplayLabel : "Amazon Bedrock" Available Models: All Amazon Bedrock chat models are compatible. Add any model IDs available in your AWS region: Anthropic Claude — All Claude model variants (Sonnet, Haiku, Opus) Amazon Nova — All Nova family models (Pro, Lite, Micro) Meta Llama — Llama models (if enabled) Mistral AI — Mistral and Mixtral models (if enabled) And more — Any Bedrock chat model Model Organization List models in order of capability (best to fastest) for a better user experience. Users will see this order in the model selector dropdown. Step 4: Enable Additional Features ¶ Enhance your LibreChat instance with file uploads, speech-to-text, and image generation. Enhanced .env Configuration # Core settings (from Step 2) OPENAI_API_KEY = your_stdapi_key_here OPENAI_REVERSE_PROXY = https://YOUR_SERVER_URL/v1 # File upload and parsing ENABLE_FILE_UPLOADS = true FILE_UPLOAD_SIZE_LIMIT = 20 # MB # Speech to Text (Whisper API compatible) STT_API_KEY = your_stdapi_key_here STT_API_URL = https://YOUR_SERVER_URL/v1 # Text to Speech TTS_API_KEY = your_stdapi_key_here TTS_API_URL = https://YOUR_SERVER_URL/v1 # Image generation DALLE_API_KEY = your_stdapi_key_here DALLE_REVERSE_PROXY = https://YOUR_SERVER_URL/v1 # Search (optional, for web search integration) # SEARCH_API_KEY=your_search_api_key Step 5: Deploy with Docker Compose ¶ Start LibreChat with all dependencies using Docker Compose. docker-compose.override.yml Create this file to customize the deployment: version : '3.8' services : api : volumes : - ./librechat.yaml:/app/librechat.yaml:ro environment : - OPENAI_API_KEY=${OPENAI_API_KEY} - OPENAI_REVERSE_PROXY=${OPENAI_REVERSE_PROXY} - STT_API_KEY=${STT_API_KEY} - STT_API_URL=${STT_API_URL} - TTS_API_KEY=${TTS_API_KEY} - TTS_API_URL=${TTS_API_URL} - DALLE_API_KEY=${DALLE_API_KEY} - DALLE_REVERSE_PROXY=${DALLE_REVERSE_PROXY} Start the application: # Start all services docker-compose up -d # View logs docker-compose logs -f # Access LibreChat at http://localhost:3080 🎯 What You Can Do Now ¶ Once deployed, LibreChat with stdapi.ai provides a full-featured AI assistant platform: 💬 Conversational AI ¶ Multi-Turn Conversations: Contextual discussions with full conversation history Model Switching: Change models mid-conversation based on task complexity Conversation Management: Save, search, share, and organize conversations Presets: Create reusable conversation templates with custom instructions 🎨 Multi-Modal Capabilities ¶ Image Generation: Create images using Amazon Nova Canvas directly in chat Voice Input: Speak your messages using speech-to-text (Amazon Transcribe) Voice Output: Listen to responses with text-to-speech (Amazon Polly) File Analysis: Upload documents for AI analysis and Q&A 👥 Team Collaboration ¶ Multi-User Support: Individual accounts with separate conversation histories User Management: Admin controls for user registration and permissions Shared Conversations: Export and share conversations with team members Usage Tracking: Monitor token usage and costs per user ⚙️ Customization ¶ Custom Prompts: Define system prompts and conversation starters Branding: Customize logo, colors, and application name Model Presets: Pre-configure optimal settings for specific use cases Plugins: Extend functionality with community plugins 🔧 Advanced Configuration ¶ User Registration and Authentication ¶ Control who can access your LibreChat instance. Authentication Settings (.env) # Allow registration (set to false for invite-only) ALLOW_REGISTRATION = true # Email verification (requires SMTP) ALLOW_EMAIL_LOGIN = true EMAIL_SERVICE = gmail EMAIL_USERNAME = your-email@gmail.com EMAIL_PASSWORD = your-app-password EMAIL_FROM = noreply@yourdomain.com # Social login (optional) GOOGLE_CLIENT_ID = your_google_client_id GOOGLE_CLIENT_SECRET = your_google_client_secret RAG and Document Intelligence ¶ Enable document uploads and semantic search for knowledge base functionality. RAG Configuration (librechat.yaml) endpoints : custom : - name : "Amazon Bedrock" apiKey : "${OPENAI_API_KEY}" baseURL : "https://YOUR_SERVER_URL/v1" models : default : - "anthropic.claude-sonnet-4-5-20250929-v1:0" - "amazon.nova-pro-v1:0" - "amazon.nova-lite-v1:0" titleConvo : true titleModel : "amazon.nova-micro-v1:0" # Enable file uploads for RAG fileConfig : endpoints : - "custom" fileLimit : 10 fileSizeLimit : 20 # MB totalSizeLimit : 100 # MB supportedMimeTypes : - "application/pdf" - "text/plain" - "text/markdown" - "application/vnd.openxmlformats-officedocument.wordprocessingml.document" Embedding Configuration (.env): # Use stdapi.ai for embeddings EMBEDDINGS_PROVIDER = openai OPENAI_API_KEY = your_stdapi_key_here EMBEDDINGS_MODEL = amazon.titan-embed-text-v2:0 Production Deployment ¶ Deploy LibreChat in production with SSL, persistent storage, and backups. Production docker-compose.yml version : '3.8' services : nginx : image : nginx:alpine ports : - "80:80" - "443:443" volumes : - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./ssl:/etc/nginx/ssl:ro depends_on : - api api : image : ghcr.io/danny-avila/librechat:latest env_file : - .env volumes : - ./librechat.yaml:/app/librechat.yaml:ro - librechat-images:/app/client/public/images - librechat-logs:/app/api/logs depends_on : - mongodb restart : unless-stopped mongodb : image : mongo:6.0 volumes : - mongodb-data:/data/db restart : unless-stopped command : mongod --quiet --logpath /dev/null volumes : mongodb-data : librechat-images : librechat-logs : Production Checklist ✅ Use HTTPS: Configure SSL certificates (Let's Encrypt recommended) ✅ Secure MongoDB: Use authentication and restrict network access ✅ Regular Backups: Backup MongoDB data and configuration files ✅ Rate Limiting: Configure rate limits in nginx to prevent abuse ✅ Monitoring: Set up logging and monitoring for uptime and performance ✅ Updates: Regularly update LibreChat and dependencies 📊 Model Recommendations ¶ Choose the right models for different use cases to optimize performance and cost. These are examples —all Bedrock models are available. Use Case Example Model Why Complex Tasks anthropic.claude-sonnet-4-5-20250929-v1:0 Superior reasoning, coding, analysis Daily Chat amazon.nova-lite-v1:0 Balanced performance for general use Quick Questions amazon.nova-micro-v1:0 Fast, cost-effective responses Long Context amazon.nova-pro-v1:0 Large context window for documents Title Generation amazon.nova-micro-v1:0 Fast, efficient for background tasks Summarization amazon.nova-lite-v1:0 Good quality at reasonable cost User Choice Let users select their preferred model for each conversation. Configure multiple models in librechat.yaml to give users flexibility based on their needs. 💡 Pro Tips & Best Practices ¶ Performance Optimization Model Selection: Use Nova Micro for title generation to reduce costs—it runs frequently Caching: Enable conversation caching to reduce redundant API calls Connection Pooling: Configure MongoDB connection pooling for better performance CDN: Serve static assets via CDN for faster page loads Cost Management Set Quotas: Configure per-user token limits to control costs Monitor Usage: Use LibreChat's built-in analytics to track token consumption Right-Size Models: Educate users on when to use efficient vs. premium models Summarization: Enable conversation summarization to reduce context token usage Security Best Practices Environment Variables: Never commit .env files—use secrets management API Key Rotation: Regularly rotate stdapi.ai API keys User Validation: Enable email verification to prevent spam registrations Content Filtering: Consider implementing content moderation policies User Experience Default Model: Set a balanced model (Nova Lite) as default for new users Presets: Create conversation presets for common use cases (coding, writing, analysis) Instructions: Add a welcome message explaining available models and features Feedback: Collect user feedback to optimize model selection and settings 🚀 Next Steps & Resources ¶ Getting Started ¶ Access LibreChat: Open http://localhost:3080 and create an account Test Models: Try different models to understand their strengths Configure Presets: Set up conversation templates for your workflows Invite Team: Share access with your team members Monitor Usage: Track token consumption and adjust as needed Learn More ¶ Additional Resources LibreChat Documentation — Official LibreChat guides and configuration API Overview — Complete list of available Bedrock models Chat Completions API — Detailed chat API documentation Configuration Guide — Advanced stdapi.ai configuration options Community & Support ¶ Need Help? 💬 Join the LibreChat Discord for tips and troubleshooting 📖 Review Amazon Bedrock documentation for model-specific details 🐛 Report LibreChat issues on GitHub 🔧 Report stdapi.ai issues on the GitHub repository ⚠️ Important Considerations ¶ Model Availability Regional Differences: Not all Amazon Bedrock models are available in every AWS region. Verify model availability in your configured region before adding them to librechat.yaml . Check availability: See the API Overview for supported models by region. Scaling Considerations User Capacity: Plan infrastructure based on expected concurrent users Database Performance: MongoDB performance is critical—consider replica sets for production API Rate Limits: Be aware of Bedrock rate limits and request quota increases if needed Storage Growth: Conversation history grows over time—plan for storage expansion Migration from OpenAI If you're already using LibreChat with OpenAI: Add stdapi.ai as a custom endpoint in librechat.yaml Keep OpenAI endpoint alongside for comparison Test thoroughly with your team before switching completely Update documentation for your users about new models Monitor cost differences and adjust based on results Back to top Previous IDE integration (Continue.dev & others) Next LangChain / LlamaIndex integration JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/use_cases_chatbots/
Chat bots (Slack, Discord & Teams) - stdapi.ai Skip to content stdapi.ai Chat bots (Slack, Discord & Teams) Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Chat bots (Slack, Discord & Teams) Table of contents About Chat Platform Bots Supported Platforms Why Chat Bots + stdapi.ai? 🤖 Quick Start Examples Slack Bot with Python Discord Bot with Python Microsoft Teams Bot with Node.js 🎯 Common Bot Features Conversation Management Command Systems Smart Features Access Control 📊 Model Selection by Use Case 🚀 Deployment Options Option 1: Cloud Hosting Option 2: Self-Hosted Option 3: Serverless 💡 Best Practices 🎨 Advanced Features RAG Integration Multi-Modal Support 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents About Chat Platform Bots Supported Platforms Why Chat Bots + stdapi.ai? 🤖 Quick Start Examples Slack Bot with Python Discord Bot with Python Microsoft Teams Bot with Node.js 🎯 Common Bot Features Conversation Management Command Systems Smart Features Access Control 📊 Model Selection by Use Case 🚀 Deployment Options Option 1: Cloud Hosting Option 2: Self-Hosted Option 3: Serverless 💡 Best Practices 🎨 Advanced Features RAG Integration Multi-Modal Support 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Home Documentation Use cases Chat Platform Bots — Slack, Discord & Teams ¶ Build intelligent chatbots for your team communication platforms powered by Amazon Bedrock models through stdapi.ai. Deploy AI assistants to Slack, Discord, Microsoft Teams, and other chat platforms—using OpenAI-compatible bot frameworks with enterprise-grade models. About Chat Platform Bots ¶ Many open-source bot frameworks and templates are designed to work with OpenAI's API, making them perfect for stdapi.ai integration. This guide covers popular platforms and bot frameworks. Supported Platforms ¶ 🔗 Slack: API Docs | Bolt Framework | Bot Examples 🔗 Discord: Developer Portal | Discord.py | Discord.js 🔗 Microsoft Teams: Developer Docs | Bot Framework 🔗 Telegram: Bot API | python-telegram-bot 🔗 Mattermost: Developer Docs | Integration Guide Why Chat Bots + stdapi.ai? ¶ AI for Team Communication Connect team communication platforms with AI assistants powered by Amazon Bedrock instead of OpenAI. Key Benefits: Claude Sonnet and other Bedrock models for conversation and context understanding Your conversations stay in your AWS environment AWS pricing for high-volume bot interactions Choose different models for different bot purposes Avoid OpenAI's strict rate limiting Compliance, audit logs, and data residency control Work in Progress This integration guide is actively being developed and refined. While the configuration examples are based on documented APIs and best practices, they are pending practical validation. Complete end-to-end deployment examples will be added once testing is finalized. 🤖 Quick Start Examples ¶ Slack Bot with Python ¶ Build a Slack bot using Bolt for Python and stdapi.ai. Installation: pip install slack-bolt openai Python - Slack Bot import os from slack_bolt import App from slack_bolt.adapter.socket_mode import SocketModeHandler from openai import OpenAI # Initialize Slack app app = App ( token = os . environ [ "SLACK_BOT_TOKEN" ]) # Initialize OpenAI client with stdapi.ai client = OpenAI ( api_key = os . environ [ "STDAPI_KEY" ], base_url = "https://YOUR_SERVER_URL/v1" ) # Store conversation history per thread conversations = {} @app . event ( "app_mention" ) def handle_mention ( event , say ): """Respond when bot is mentioned""" thread_ts = event . get ( "thread_ts" , event [ "ts" ]) user_message = event [ "text" ] # Get or create conversation history if thread_ts not in conversations : conversations [ thread_ts ] = [] # Add user message to history conversations [ thread_ts ] . append ({ "role" : "user" , "content" : user_message }) # Get AI response response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = conversations [ thread_ts ], max_tokens = 1000 ) assistant_message = response . choices [ 0 ] . message . content # Add assistant response to history conversations [ thread_ts ] . append ({ "role" : "assistant" , "content" : assistant_message }) # Reply in thread say ( text = assistant_message , thread_ts = thread_ts ) @app . command ( "/ask" ) def handle_ask_command ( ack , command , say ): """Handle /ask slash command""" ack () response = client . chat . completions . create ( model = "amazon.nova-lite-v1:0" , messages = [{ "role" : "user" , "content" : command [ "text" ]}] ) say ( response . choices [ 0 ] . message . content ) if __name__ == "__main__" : # Start the app with Socket Mode handler = SocketModeHandler ( app , os . environ [ "SLACK_APP_TOKEN" ]) handler . start () Environment Variables: SLACK_BOT_TOKEN = xoxb-your-bot-token SLACK_APP_TOKEN = xapp-your-app-token STDAPI_KEY = your_stdapi_key Discord Bot with Python ¶ Create a Discord bot using discord.py and stdapi.ai. Installation: pip install discord.py openai Python - Discord Bot import os import discord from discord.ext import commands from openai import OpenAI # Initialize bot intents = discord . Intents . default () intents . message_content = True bot = commands . Bot ( command_prefix = "!" , intents = intents ) # Initialize OpenAI client with stdapi.ai client = OpenAI ( api_key = os . environ [ "STDAPI_KEY" ], base_url = "https://YOUR_SERVER_URL/v1" ) # Store conversations per channel conversations = {} @bot . event async def on_ready (): print ( f "Bot is ready as { bot . user } " ) @bot . command ( name = "ask" ) async def ask ( ctx , * , question ): """Ask the AI a question""" async with ctx . typing (): response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : question }], max_tokens = 1000 ) answer = response . choices [ 0 ] . message . content # Split long messages if len ( answer ) > 2000 : chunks = [ answer [ i : i + 2000 ] for i in range ( 0 , len ( answer ), 2000 )] for chunk in chunks : await ctx . send ( chunk ) else : await ctx . send ( answer ) @bot . command ( name = "chat" ) async def chat ( ctx , * , message ): """Chat with context from conversation history""" channel_id = ctx . channel . id # Initialize conversation history for channel if channel_id not in conversations : conversations [ channel_id ] = [] # Add user message conversations [ channel_id ] . append ({ "role" : "user" , "content" : message }) # Keep only last 10 messages for context if len ( conversations [ channel_id ]) > 20 : conversations [ channel_id ] = conversations [ channel_id ][ - 20 :] async with ctx . typing (): response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = conversations [ channel_id ] ) answer = response . choices [ 0 ] . message . content # Add assistant response conversations [ channel_id ] . append ({ "role" : "assistant" , "content" : answer }) await ctx . send ( answer ) @bot . command ( name = "reset" ) async def reset ( ctx ): """Clear conversation history""" channel_id = ctx . channel . id if channel_id in conversations : del conversations [ channel_id ] await ctx . send ( "Conversation history cleared!" ) # Run the bot bot . run ( os . environ [ "DISCORD_TOKEN" ]) Environment Variables: DISCORD_TOKEN = your_discord_bot_token STDAPI_KEY = your_stdapi_key Microsoft Teams Bot with Node.js ¶ Build a Teams bot using Bot Framework and stdapi.ai. Installation: npm install botbuilder openai JavaScript - Teams Bot const { ActivityHandler } = require ( 'botbuilder' ); const OpenAI = require ( 'openai' ); class TeamsBot extends ActivityHandler { constructor () { super (); // Initialize OpenAI client with stdapi.ai this . client = new OpenAI ({ apiKey : process . env . STDAPI_KEY , baseURL : 'https://YOUR_SERVER_URL/v1' }); // Store conversations this . conversations = new Map (); // Handle message activities this . onMessage ( async ( context , next ) => { const userMessage = context . activity . text ; const conversationId = context . activity . conversation . id ; // Get or create conversation history if ( ! this . conversations . has ( conversationId )) { this . conversations . set ( conversationId , []); } const history = this . conversations . get ( conversationId ); // Add user message history . push ({ role : 'user' , content : userMessage }); // Get AI response const response = await this . client . chat . completions . create ({ model : 'anthropic.claude-sonnet-4-5-20250929-v1:0' , messages : history , max_tokens : 1000 }); const botReply = response . choices [ 0 ]. message . content ; // Add bot response to history history . push ({ role : 'assistant' , content : botReply }); // Keep last 20 messages if ( history . length > 40 ) { this . conversations . set ( conversationId , history . slice ( - 40 ) ); } // Send reply await context . sendActivity ( botReply ); await next (); }); // Handle members added this . onMembersAdded ( async ( context , next ) => { const welcomeText = 'Hello! I\'m your AI assistant. Ask me anything!' ; for ( const member of context . activity . membersAdded ) { if ( member . id !== context . activity . recipient . id ) { await context . sendActivity ( welcomeText ); } } await next (); }); } } module . exports . TeamsBot = TeamsBot ; 🎯 Common Bot Features ¶ Conversation Management ¶ Thread/Channel Context: Store conversation history per thread or channel Limit context to recent messages (last 10-20 messages) Clear history on command or timeout Support multiple simultaneous conversations Context Management Pattern MAX_HISTORY = 20 # Keep last 20 messages def manage_context ( conversation_id , new_message ): if conversation_id not in conversations : conversations [ conversation_id ] = [] conversations [ conversation_id ] . append ( new_message ) # Trim old messages if len ( conversations [ conversation_id ]) > MAX_HISTORY : conversations [ conversation_id ] = conversations [ conversation_id ][ - MAX_HISTORY :] return conversations [ conversation_id ] Command Systems ¶ Slash Commands / Bot Commands: /ask <question> — Quick one-off questions /chat <message> — Contextual conversation /reset — Clear conversation history /help — Show available commands /model <model_name> — Switch AI model Smart Features ¶ Enhanced Capabilities: @mentions Detection — Respond only when mentioned Direct Messages — Private 1-on-1 conversations Reaction Triggers — React to specific emoji reactions Scheduled Messages — Automated daily summaries or reminders File Processing — Analyze uploaded documents or images Access Control ¶ Security & Permissions: Channel Restrictions — Limit bot to specific channels Role-Based Access — Different features for different user roles Rate Limiting — Prevent abuse with per-user rate limits Audit Logging — Track all bot interactions for compliance 📊 Model Selection by Use Case ¶ Choose models based on bot purpose. These are examples —all Bedrock models are available. Bot Purpose Example Model Why General Assistant anthropic.claude-sonnet-4-5-20250929-v1:0 Best conversation quality and context understanding Quick Q&A amazon.nova-lite-v1:0 Fast responses, cost-effective for high volume Technical Support anthropic.claude-sonnet-4-5-20250929-v1:0 Superior at technical explanations and debugging Simple Commands amazon.nova-micro-v1:0 Very fast, efficient for basic queries Long Discussions amazon.nova-pro-v1:0 Large context window for complex conversations 🚀 Deployment Options ¶ Option 1: Cloud Hosting ¶ Deploy bots to cloud platforms for reliability and scalability. Heroku Deployment # Install Heroku CLI # Create app heroku create my-slack-bot # Set environment variables heroku config:set SLACK_BOT_TOKEN = xoxb-... heroku config:set STDAPI_KEY = your_key # Deploy git push heroku main Popular Platforms: Heroku — Easy deployment, free tier available AWS Lambda — Serverless, pay per use Google Cloud Run — Container-based, autoscaling Railway — Simple, modern deployment Fly.io — Global edge deployment Option 2: Self-Hosted ¶ Run bots on your own infrastructure for full control. Docker Deployment FROM python:3.11-slim WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt COPY bot.py . CMD [ "python" , "bot.py" ] docker build -t my-bot . docker run -e SLACK_BOT_TOKEN = $TOKEN -e STDAPI_KEY = $KEY my-bot Option 3: Serverless ¶ Use serverless functions for cost-effective, scalable bots. AWS Lambda + API Gateway Deploy bot as Lambda function Use API Gateway for webhook endpoint Store conversation state in DynamoDB Scale automatically with demand 💡 Best Practices ¶ Performance Optimization Async Operations: Use async/await for non-blocking bot responses Typing Indicators: Show "typing..." while generating responses Response Streaming: Stream long responses in chunks Caching: Cache frequent queries to reduce API calls User Experience Clear Commands: Document all bot commands with /help Error Handling: Graceful error messages, not technical stack traces Feedback: Allow users to rate responses or report issues Context Limits: Inform users when context is cleared Security & Privacy Environment Variables: Never hardcode API keys in source code Message Filtering: Sanitize user input before sending to AI Data Retention: Clear conversation history after timeout Access Logs: Monitor bot usage for suspicious activity Channel Privacy: Respect private channel settings Cost Management Model Selection: Use efficient models for simple queries Context Management: Limit conversation history length Rate Limiting: Prevent abuse with per-user limits Monitoring: Track token usage and set budget alerts 🎨 Advanced Features ¶ RAG Integration ¶ Document Search & Retrieval: Integrate vector search to answer questions from your team's knowledge base. RAG-Enhanced Bot from openai import OpenAI import chromadb # Initialize clients ai_client = OpenAI ( api_key = os . environ [ "STDAPI_KEY" ], base_url = "https://YOUR_SERVER_URL/v1" ) # Vector database for documents chroma_client = chromadb . Client () collection = chroma_client . create_collection ( "team_docs" ) def answer_with_context ( question ): # Search relevant documents results = collection . query ( query_texts = [ question ], n_results = 3 ) context = " \n\n " . join ( results [ 'documents' ][ 0 ]) # Generate answer with context response = ai_client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : f "Context: \n { context } \n\n Question: { question } " }] ) return response . choices [ 0 ] . message . content Multi-Modal Support ¶ Handle Images & Files: Process images, documents, and other files shared in chat. Image Analysis Bot @bot . command ( name = "analyze" ) async def analyze_image ( ctx ): """Analyze attached images""" if ctx . message . attachments : for attachment in ctx . message . attachments : if attachment . content_type . startswith ( 'image/' ): # Download image image_data = await attachment . read () # Send to vision-capable model # (Note: depends on model support) response = client . chat . completions . create ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , messages = [{ "role" : "user" , "content" : "Describe this image" }] ) await ctx . send ( response . choices [ 0 ] . message . content ) 🚀 Next Steps & Resources ¶ Getting Started ¶ Choose Your Platform: Start with Slack or Discord for easiest setup Create Bot Account: Register bot in platform's developer portal Deploy Example Code: Use one of the examples above as a starting point Configure stdapi.ai: Add your credentials and select models Test & Iterate: Start in test channel, gather feedback, improve Learn More ¶ Additional Resources Slack Bolt Framework — Official Slack bot framework Discord.py Documentation — Comprehensive Discord bot guide Bot Framework Docs — Microsoft Teams bot development API Overview — Complete list of available Bedrock models Chat Completions API — Detailed API documentation Community & Support ¶ Need Help? 💬 Platform-specific developer communities (Slack, Discord, Teams) 📖 Review Amazon Bedrock documentation for model-specific details 🐛 Report issues on the GitHub repository ⚠️ Important Considerations ¶ Model Availability Regional Differences: Not all Amazon Bedrock models are available in every AWS region. Verify model availability before deployment. Check availability: See the API Overview for supported models by region. Rate Limits & Scaling Bot Rate Limits: Chat platforms have rate limits—implement proper throttling Concurrent Users: Plan for multiple simultaneous conversations State Management: Use databases for persistent conversation storage in production Compliance & Data Privacy Message Logging: Be transparent about what data is stored Retention Policies: Implement automatic data deletion policies GDPR/Privacy Laws: Ensure compliance with applicable regulations User Consent: Inform users about AI interactions and data usage Back to top Previous Note-taking apps (Obsidian & Notion) Next Autonomous agents (AutoGPT & more) JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://stdapi.ai/operations_licensing/
Licensing - stdapi.ai Skip to content stdapi.ai Licensing Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Licensing Table of contents Choose the License That Fits Your Business Why Go Commercial? Keep Your Code Private Deploy with Confidence Modify & Distribute Freely Enterprise-Ready Terms Production-Grade Infrastructure Commercial License Benefits Getting Your Commercial License Frequently Asked Questions Questions? Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents Choose the License That Fits Your Business Why Go Commercial? Keep Your Code Private Deploy with Confidence Modify & Distribute Freely Enterprise-Ready Terms Production-Grade Infrastructure Commercial License Benefits Getting Your Commercial License Frequently Asked Questions Questions? Home Documentation Operations Licensing ¶ Choose the License That Fits Your Business ¶ stdapi.ai is available under a dual-license model designed to support both open-source communities and commercial enterprises: AGPL-3.0-or-later Free and open source for those who share alike Perfect for open-source projects, research, and non-commercial use View License Commercial License Freedom to build proprietary solutions Seamlessly integrate into your commercial products without restrictions Get Started Why Go Commercial? ¶ A commercial license through AWS Marketplace provides: Keep Your Code Private ¶ Build proprietary applications without source code disclosure requirements. Your intellectual property stays yours. Deploy with Confidence ¶ No copyleft obligations - integrate stdapi.ai into your products and services without legal complexity. Modify & Distribute Freely ¶ Customize stdapi.ai to fit your needs and distribute it as part of your commercial offerings. Enterprise-Ready Terms ¶ Licensed under the AWS Marketplace Standard Contract (SCMP) . Production-Grade Infrastructure ¶ Access to hardened and optimized container images, regular security updates, and streamlined deployment options. Commercial License Benefits ¶ Full Commercial Rights Use in closed-source applications, modify freely, and distribute as part of your products No Source Disclosure AGPL network use requirements don't apply—keep your modifications private Internal Network Freedom Deploy on internal networks without triggering AGPL's source disclosure obligations Streamlined Procurement Purchase through AWS Marketplace with familiar terms and billing Hardened Container Images Optimized and security-hardened containers built for production workloads Regular Security Updates Stay protected with timely security patches and vulnerability fixes Easy Deployment Options Quick deployment workflows optimized for AWS infrastructure AWS Best Practices Deployment options follow AWS Well-Architected Framework guidelines Getting Your Commercial License ¶ To obtain a commercial license: Visit AWS Marketplace and subscribe Accept the Standard Contract during checkout Receive your product code automatically upon purchase Deploy immediately with commercial rights activated Straightforward enterprise licensing through AWS Marketplace. Frequently Asked Questions ¶ Can I try before I buy? Yes. Start with the AGPL-3.0 version for evaluation and development. When ready for production deployment in proprietary applications, upgrade to the commercial license through AWS Marketplace. The commercial license also includes a 14-day free trial, allowing you to test the full capabilities in your production environment risk-free. This allows you to validate stdapi.ai's capabilities before committing to a commercial license. Do I need a commercial license for internal tools? Most likely, yes. The AGPL-3.0 license requires source code disclosure even for software accessed over a network (like internal APIs and tools). If you're building internal applications that your team or organization accesses over a network, a commercial license removes these obligations and lets you keep your code private. What if my project is already AGPL-compliant? If you're comfortable open-sourcing your entire application under AGPL-3.0, the free version is all you need. The commercial license is for organizations that need to keep their code proprietary or integrate stdapi.ai into commercial products. Can I switch from AGPL to commercial later? Yes. Many customers start with the AGPL version during development and testing, then switch to the commercial license when deploying to production. Your product code activates commercial licensing automatically - no migration or technical changes required. What's included in the AWS Marketplace Standard Contract? The AWS Marketplace Standard Contract (SCMP) provides: Clear license grant terms for commercial use Standard warranty and liability provisions Straightforward payment and billing terms Professional indemnification terms It's the same trusted contract used across thousands of enterprise software products on AWS Marketplace. Questions? ¶ Our team is available to help you choose the right licensing option for your use case. Email: sales@stdapi.ai Contact us for clarification on licensing terms, volume pricing, or custom deployment scenarios. Back to top Previous Configuration Next Logging & Monitoring JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
http://hackage.haskell.org/upload#versioning_and_curation
Uploading packages and package candidates | Hackage Hackage :: [Package] Search  Browse What's new Upload User accounts Uploading packages Upload and publish a package permanently : Upload Uploading a package puts it in the package index so that anyone can download it and view information about it. You can only upload a package version once and this cannot be undone , so try to get it right the first time! To reduce the risk of mistakes it's recommended to use the package candidates feature described below. Because each package added to the main package index has a cost of operation and maintenance associated to it, your package should strive to provide value for the community by being intended to be useful to others , which entails giving your package a meaningful synopsis/description as well as ensuring your package is installable by helping with providing accurate meta-data. Packages must be in the form produced by Cabal's sdist command: a gzipped tar file package - version .tar.gz comprising a directory package - version containing a package of that name and version, including package .cabal . See the notes at the bottom of the page. A Cabal package name can use any alphabetic Unicode code-point, however Hackage rejects package names that use alphabetic code-points other than those from the Latin alphabet (that is, A to Z and a to z ). With one exception, the name of a new package cannot be the same as the name of an existing package, based on a case-insensitive comparison. The exception is if the maintainer uploading the new package is a maintainer of the existing package. Version history and change logs If a package includes a ChangeLog file (in either plain text or Markdown format), Hackage will link to it on the corresponding package page. The following filenames are recognized: basename change_log changelog changes news extension (none) .txt .md .markdown ChangeLog names are matched case-insensitively: NEWS , Changes.TXT , and ChangeLog.md will all work. Package versioning and curation By default, uploaded packages are curated which means that both maintainers and hackage trustees may revise their metadata (particularly involving version bounds) to guide build tools in producing install-plans. (For more information on revisions, see the FAQ ). In order to ensure the integrity and well-functioning of the Hackage/Cabal ecosystem, all curated packages should follow Haskell's Package Versioning Policy (PVP) . In particular, be aware that although the PVP and SemVer are based on the same concepts they differ significantly in structure and consequently are not compatible with each other. Please consult the PVP/SemVer FAQ section for more details about the differences and related issues. Further, an important property of the PVP contract is that it can only be effective and provide strong enough guarantees if it is followed not only by an individual package, but also by that package's transitive dependencies. Consequently, packages which are curated should aim to depend only on other curated packages. In the course of the curation process, the Hackage Trustees need to be able to contact package maintainers, to inform them about and help to resolve issues with their packages (including its meta-data) which affect the Hackage ecosystem. Package uploaders may choose to exclude individual package uploads from curation, by setting the x-curation: field of the package's cabal file to uncurated . Packages which are uncurated have no expectations on them regarding versioning policy. Trustees or maintainers may adopt uncurated packages into the curated layer through metadata revisions. Metadata revisions must not set the value of the x-curation field to any variant of uncurated . Two variants of the uncurated property are supported. First, uncurated-no-trustee-contact , which indicates that maintainers do not wish to be contacted by trustees regarding any metadata issues with the package. (Contact may still occur over issues that are not related to curation, such as licensing, etc.). Second, uncurated-seeking-adoption , which indicates that maintainers would like their package to be adopted in the curated layer, but currently some issue prevents this, which they would like assistance with. In the future, metadata regarding curation will be made available in the UI of Hackage, and different derived indexes will be provided for the uncurated and curated layers of packages. Open source licenses The code and other material you upload and distribute via this site must be under an open source license . This is a service operated for the benefit of the community and that is our policy. It is also so that we can operate the service in compliance with copyright laws. The Hackage operators do not want to be in the business of making judgements on what is and is not a valid open source license, but we retain the right to remove packages that are not under licenses that are open source in spirit, or that conflict with our ability to operate this service. (If you want advice, see the ones Cabal recommends .) The Hackage operators do not need and are not asking for any rights beyond those granted by the open source license you choose to use. All normal open source licenses grant enough rights to be able to operate this service. In particular, we expect as a consequence of the license that: we have the right to distribute what you have uploaded to other people we have the right to distribute certain derivatives and format conversions, including but not limited to: documentation derived from the package alternative presentations and formats of code (e.g. html markup) excerpts and presentation of package metadata modified versions of package metadata Please make sure that you comply with the license of all code and other material that you upload. For example, check that your tarball includes the license files of any 3rd party code that you include. Public repositories It is preferable if any web pages linked from the following fields are publicly accessible: Bug report URL Homepage URL Source repositories In particular, where these fields refer to a repository, a public repository is preferable. This gives users access to existing issues (e.g. to check for duplicates before raising a bug) and package version history. It also enables users to gauge whether packages are being actively maintained or developed. That said, links to private repositories are acceptable, just not as useful. Privileges To upload a package, you'll need a Hackage username and password. If you upload a package or package candidate and no other versions exist in the package database, you become part of the maintainer group for that package, and you can add other maintainers if you wish. If a maintainer group exists for a package, only its members can upload new versions of that package. If there is no maintainer, the uploader can remove themselves from the group, and a package trustee can add anyone who wishes to assume the responsibility. The Maintainer field of the Cabal file should be None in this case. If a package is being maintained, any release not approved and supported by the maintainer should use a different package name. Then use the Maintainer field as above either to commit to supporting the fork yourself or to mark it as unsupported. Group Accounts Occasionally organizations want to have a group / organizational account for a package that is maintained by a group of people. The recommended approach for these cases is to only do package uploads from individual accounts and use the group account only for managing the maintainer list for the package. Package Candidates Package candidates are a way to preview the package page, view any warnings or possible errors you might encounter, and let others install it before publishing it to the main index. (Note: you can view these warnings with 'cabal check'.) You can have multiple candidates for each package at the same time so long as they each have different versions. Finally, you can publish a candidate to the main index if it's not there already. Package candidates have not yet been fully implemented and are still being improved; see Package Candidates Project Dashboard for an overview of what still needs to be done. Upload a package candidate Notes You should check that your source bundle builds, including the haddock documentation if it's a library. Categories are determined by whatever you put in the Category field. You should try to pick existing categories when possible. You can have more than one category, separated by commas. If no other versions of the package exist, the categories automatically become the package's tags. Occasional changes to the GHC base package can mean that some work needs to be done to make packages compatible across a range of versions. See these notes for some tips in how to do so. There are some notes for upgrading much older packages as well. The hackage-server attempts to build documentation for library packages, but this can fail. Maintainers can generate their own documentation and upload it by using something along the lines of the shell script below (note that the last two commands are the key ones): #!/bin/sh set -e dir=$(mktemp -d dist-docs.XXXXXX) trap 'rm -r "$dir"' EXIT # assumes cabal 2.4 or later cabal v2-haddock --builddir="$dir" --haddock-for-hackage --enable-doc cabal upload -d --publish $dir/*-docs.tar.gz
2026-01-13T09:30:24
http://hackage.haskell.org/package/semigroupoids-4.2/docs/Data-Functor-Extend.html#g:1
Data.Functor.Extend Source Contents Index semigroupoids-4.2: Semigroupoids: Category sans id Portability portable Stability provisional Maintainer Edward Kmett <ekmett@gmail.com> Safe Haskell Safe Data.Functor.Extend Contents Extendable Functors Description   Synopsis class Functor w => Extend w where duplicated :: w a -> w (w a) extended :: (w a -> b) -> w a -> w b Extendable Functors There are two ways to define an Extend instance: I. Provide definitions for extended satisfying this law: extended f . extended g = extended (f . extended g) II. Alternately, you may choose to provide definitions for duplicated satisfying this law: duplicated . duplicated = fmap duplicated . duplicated You may of course, choose to define both duplicated and extended . In that case you must also satisfy these laws: extended f = fmap f . duplicated duplicated = extended id These are the default definitions of extended and duplicated . class Functor w => Extend w where Source Methods duplicated :: w a -> w (w a) Source duplicated = extended id fmap (fmap f) . duplicated = duplicated . fmap f extended :: (w a -> b) -> w a -> w b Source extended f = fmap f . duplicated Instances Extend []   Extend Maybe   Extend Identity   Extend Tree   Extend Seq   Extend NonEmpty   Semigroup m => Extend ((->) m)   Extend ( Either a)   Extend ( (,) e)   Extend w => Extend ( IdentityT w)   Extend f => Extend ( MaybeApply f)   ( Extend f, Extend g) => Extend ( Coproduct f g)   ( Extend w, Semigroup m) => Extend ( TracedT m w)   Extend w => Extend ( StoreT s w)   Extend w => Extend ( EnvT e w)   ( Extend f, Semigroup a) => Extend ( Static f a)   Produced by Haddock version 2.13.2
2026-01-13T09:30:24
https://in-toto.io#moon-stars-fill
in-toto in-toto About Docs Ecosystem Community Blog News Light Dark Auto A framework to secure the integrity of software supply chains Learn More Get started Try the demo in-toto is designed to ensure the integrity of a software product from initiation to end-user installation. It does so by making it transparent to the user what steps were performed, by whom and in what order. Open, extensible standard An open metadata standard that you can implement in your software’s supply chain. Read more Adoptions and Integrations Explore integrations and adopters of in-toto. Read more Extensive tooling Use in-toto today through Apache-licensed libraries and tools. Read more in-toto is a CNCF graduated project . © 2020–2025 in-toto Authors CC BY 4.0 | Trademarks | Funding | All Rights Reserved Privacy Policy
2026-01-13T09:30:24
http://unicode.org/faq/index.html
FAQ - Unicode Frequently Asked Questions Tech Site | Site Map | Search Frequently Asked Questions Frequently Asked Questions The Unicode Frequently Asked Questions (FAQ) are organized into different topic pages. A list of topic areas with links is shown below, along with brief explanations of what kinds of questions are answered in each topic area. Many FAQ pages contain links to other pages where you will find further information about specific topics. Check in particular the Basic Questions and Specifications pages. As another option, you may find it easier to go to the search page and type in your topic plus "FAQ" to locate appropriate FAQ entries. For example " NFC FAQ", " BOM FAQ", "Tamil FAQ", and so forth. If you have a question not addressed by the FAQ entries, you may join the public Unicode emaillist and post your question there. The FAQs are contributed by many people. For more information about sources, see Attribution . If you would like to help and have prepared an FAQ entry with a useful answer that you would like to contribute, please send the question and the answer to us and the Unicode editorial working group will consider posting it. Basic Questions Discusses the features of Unicode, how it differs from other encodings, and answers basic support questions such as where to find additional information on this site. Arabic Script Issues related to the Arabic script and languages using the Arabic script. Bengali (Bangla) / Assamese Script Issues related to the Bengali (Bangla) script and Assamese. Blocks and Ranges Definitions and usage of Unicode blocks and ranges, and questions about blocks versus script values for characters. Character Properties, Case Mappings and Names Answers questions about case conversions and case mappings ; also about character names . Characters and Combining Marks Discusses a variety of details about text elements , combining characters , compatibility mappings, and canonical equivalence . Chinese and Japanese Questions specific to Han ideographs , Chinese and Japanese language handling, and East Asian fonts . CLDR and Locales Answers questions about Unicode Locales, CLDR , and LDML . Collation Answers to questions of sorting and ordering, Unicode and Java. Compression The Unicode compression algorithm ( SCSU ), LZW , Huffman encoding, and others. Conversions / Mappings Conversion and mapping to/from other character sets . Coping with Change Adapting to changes in the Unicode Standard. Display of Unsupported Characters Discusses what to do when attempting to display unsupported Unicode characters. Emoji and Pictographs Discusses sets of pictorial symbols including Emoji , Dingbats , Webdings and Wingdings, how and why they have been encoded and how to display or implement them. Emoji Submission Discusses the submission process for proposals for new emoji. Entities and Named Sequences Discusses named entities and Unicode named character sequences . FAQ on FAQs Describes how and when new FAQs are created, how FAQs relate to specifications, and and what to do if you think there is an error in a Unicode specification. Fonts & Keyboards Where to find more information about fonts. Displaying characters in Java. Glyph variations. Inputting Chinese and other characters. Greek Questions specific to the Greek language, script, and fonts. Guide to Abbreviations in Standards Lists abbreviations and acronyms used by other standards developing organizations. Indic Scripts and Languages (except Tamil or Bengali) Questions specific to Indic scripts, languages, fonts, and keyboards. Internationalization Explains the role of Unicode in internationalization of software and answers questions about upgrading software to support Unicode. Internationalized Domain Names (IDN) Provides a series of background explanations about International Domain names and the different specifications for them. Korean Questions about Hangul and Jamo characters for Korean, and Korean normalization issues. Language Tagging Plane 14 language tags and language tagging in general. Latin and Cyrillic Questions about the Latin and Cyrillic scripts. Ligatures, Digraphs, Presentation Forms vs. Plain Text Can't find a certain digraph or ligature your language needs? Can you use a particular presentation form ? Line Breaking Questions about how to break text into separate lines for display. Myanmar Issues related to the Myanmar script and fonts, and to languages which use the script. Normalization Questions regarding the various normalization forms , their use, and where to go for further information. Private-Use Characters, Noncharacters, and Sentinels Questions about private-use characters and how they are distinguished from noncharacters and sentinels. Programming Issues Questions regarding conversion of string handling in old programs, as well as other issues regarding support of Unicode strings in programs. Proposing New Characters What are the latest proposals? What about my script? When will the next version of the Unicode Standard be available? Punctuation and Symbols Discusses issues related to punctuation and symbols, including the differences between them. Security Issues Does Unicode pose security problems? What can be done about such problems as character spoofing? Specifications Information on where to find specifications or guidelines for dealing with different programming tasks in the Unicode Standard and related standards. Standards Developing Organizations Describes what SDOs are and how the Unicode Consortium works with them. Answers questions about ISO, IETF, W3C , and the terminology they use. Submitting Successful Character and Script Proposals Guidelines on how to write a successful proposal to add new characters or a new script, or to fix a problem in the standard. Tamil Script and Language Issues related to the Tamil language and script Technical Reports Development Process Discusses the development and maintenance process for technical reports, including how they are created and archived. Unicode and ISO 10646 Relationships between Unicode and ISO working groups, ISO standards. How Unicode differs from 10646. Unicode and the Web Unicode in other standards (W3C, IETF, ...). How to deal with numeric character references. Unicode in HTML. Unicode Character Database Questions about the Unicode Character Database ( UCD ). Unicode Terms of Use & License Questions about the Unicode Terms of Use and Unicode License. UTF-8, UTF-16, UTF-32 & BOM Questions about encoding forms ( UTF-8 , UTF-16 , and UTF-32 ) and use of the byte order mark . Variation Sequences Answers questions about the meaning, use, and display of variation sequences and selectors. Writing Direction & BIDI Ordering Questions about writing direction , particularly “bidi” bidirectional left-right and right-left text.
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2010/11/hats-off.html
don't count on finding me: Hats off skip to main | skip to sidebar don't count on finding me Tuesday, November 23, 2010 Hats off The types subreddit references Chuan-kai Lin's PhD thesis about GADT type inference. I already have read the pointwise paper , but this is of course a revelation. He actually did implement an algorithm that inferred types for 25 (out of 30) little benchmark programs with GADTs. Previous attempts accomplished at most one! But the thing that impressed me the most wasn't the technical side of his story but the beautifully crafted slides of his PhD defense talk. I am baffled... Congratulations Chuan-kai! Posted by heisenbug at 6:09 PM Labels: GADT , types No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ▼  2010 (19) ►  December (5) ▼  November (6) More on Existentials Applicative Structures and Thrists Type Synonyms Generalized Patterns and Existentials Hats off Cooperation ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2010/11/cooperation.html
don't count on finding me: Cooperation skip to main | skip to sidebar don't count on finding me Friday, November 12, 2010 Cooperation I have just uploaded the thrist-0.2 package to hackage. All credit goes to Brandon Simmons , who has added significant functionality and now provides some functions for thrists that are more in line with the prelude. Brandon has accepted to be a co-author to the library and I am very happy about it. Welcome, Brandon! For the users of the package this is good news, as I am a little dim spot on the outer sectors of the haskell radar, while Brandon is a savvy and ambitioned person, and to continue with my previous metaphor, a bright green dot on the screen, swiftly moving towards the center :-) This post is a kind of mini release note for the release. Being an experimental package we do not intend to guarantee API stability, so we took the freedom to rename routines to make naming more consistent with the prelude. foldThrist is now foldrThrist and it got a bunch of new cousins too. Notably the types are much wider now, which allows for some more magic to happen. Finally, the haddock comments have been enhanced and as-of-present actually tell something. Please ignore the sub-modules for now, they are unfinished, and much more experimental than the rest (I have not got around researching a compelling solution yet). A RevThrist (or similar) GADT did not make it into the release, I hope I can cram it in sometime later. Anyway, enjoy the lib! Posted by heisenbug at 5:55 PM Labels: hackage , haskell , thrist No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ▼  2010 (19) ►  December (5) ▼  November (6) More on Existentials Applicative Structures and Thrists Type Synonyms Generalized Patterns and Existentials Hats off Cooperation ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
https://docs.asciidoctor.org/asciidoctor/latest/convert/
Converters | Asciidoctor Docs Asciidoctor Docs In this project AsciiDoc Language Syntax Quick Reference Processing Asciidoctor Ruby Asciidoctor.js JavaScript AsciidoctorJ Java Extensions Add-on Converters PDF Ruby EPUB3 Ruby reveal.js Ruby, JavaScript Source Compilers Reducer Ruby, JavaScript Extended Syntax Asciidoctor Diagram Ruby Tooling Build Automation Maven Tools Java Gradle Plugin Java Asciidoclet Java Text Editors / Viewers Browser Extension IntelliJ Plugin Chat List --> Source Tweets Asciidoctor Features What’s New in 2.0 Install and Update Supported Platforms Install Using Ruby Packaging Install Using Linux Packaging Install on macOS Install on Windows Convert Your First File Converters Available Converters Custom Converter Converter Templates Convertible Contexts Generate HTML Stylesheets Default Stylesheet Stylesheet Modes Apply a Custom Stylesheet Embed a CodeRay or Pygments Stylesheet Manage Images Use Local Font Awesome Add a Favicon Verbatim Block Line Wrapping Skip Front Matter Generate DocBook Generate Manual Pages Process AsciiDoc Using the CLI asciidoctor(1) Specify an Output File Process Multiple Source Files Pipe Content Through the CLI Set Safe Mode CLI Options Process AsciiDoc Using the API Load and Convert Files Load and Convert Strings Generate an HTML TOC Set Safe Mode Enable the Sourcemap Catalog Assets Find Blocks API Options Safe Modes Safe Mode Specific Content AsciiDoc Tooling Syntax Highlighting Highlight.js Rouge CodeRay Pygments Custom Adapter STEM Processing MathJax and HTML Asciidoctor Mathematical STEM Support in the DocBook Toolchain AsciiMath Gem Extensions Register Extensions Log from an Extension Preprocessor Tree Processor Postprocessor Docinfo Processor Block Processor Compound Block Processor Block Macro Processor Inline Macro Processor Include Processor Localization Support Errors and Warnings Migration Guides Upgrade from Asciidoctor 1.5.x to 2.0 Migrate from AsciiDoc.py Migrate from DocBook XML Migrate from Markdown Migrate from Confluence XHTML Migrate from MS Word Asciidoctor 2.0 AsciiDoc Asciidoctor 2.0 Asciidoctor.js 3.0 2.2 AsciidoctorJ 3.0 2.5 Asciidoctor PDF 2.3 2.2 2.1 2.0 Asciidoctor EPUB3 2.3 Asciidoctor reveal.js 5.0 4.1 Maven Tools 3.2 Gradle Plugin Suite 5.0 4.0 Asciidoclet 2.0 1.5.6 Asciidoctor Diagram 3.0.1 Browser Extension Community Asciidoctor Converters Edit this Page Converters After Asciidoctor parses an AsciiDoc document, it uses a converter to generate the output format of your choice, such as HTML, DocBook, or PDF. Asciidoctor includes a handful of built-in converters . The Asciidoctor project provides additional converters that you can add on, which are distributed separately. You also have the option to create your own converter or to use one published by a third party. When working with converters, it’s important to understand the distinction between a converter and a backend. This page explains that difference while also providing more background on how converters function. What is a converter? A converter takes AsciiDoc and transforms it into a different format. More specifically, it processes each node (i.e., block or inline element) in a parsed AsciiDoc document in document order and returns a converted fragment, which the processor combines to create the output document. Each converter produces a specific output format, such as HTML or DocBook XML. Asciidoctor provides several built-in converters and a facility for adding additional converters. In addition to generating traditional articles and books from AsciiDoc documents, you can also use Asciidoctor to create HTML-based slide decks, static websites, and documentation sites. When using these add-on converters, you may need to include some additional structure rules to a document. However, nothing in this structure restricts you from being able to publish the content as a normal document, too. What is a backend? Each converter is correlated with an output format using a backend identifier. From the user’s perspective, the backend represents the desired output format. A converter will register itself with a backend identifier to claim that it produces that output format. For example, the backend identifier for the built-in HTML 5 converter is html5 . Thus, from the processor’s perspective, the backend is the value it uses to identify which converter to use. The term backend is often used interchangeably with the name of a converter. For example, you might hear “the html5 backend” when someone is talking about the HTML 5 converter. However, there’s an important distinction between these terms. A custom converter can either introduce or reclaim a backend identifier. Since it’s possible for a converter to reclaim a backend identifier, we can’t say that a backend universally equates to a given converter. Rather, the backend identifier informs the processor which converter to select to handle the requested backend based on what’s currently registered. The user selects which converter to use to convert a document by specifying the backend document attribute, -b ( --backend ) command line option, or backend API option (e.g., --backend=docbook5 ). The html5 and docbook5 backends can be referred to using the aliases html and docbook , respectively. In summary, a converter is a software component that handles the conversion from a parsed AsciiDoc document to a publishable output format. The backend represents the user’s intent to transform the AsciiDoc document to a given format (e.g., html5 for HTML 5). That backend also serves as an identifier that tells the processor which converter to use. More than one converter can bind to (i.e., stake claim to) the same backend in order to provide the user with alternatives for generating a given output format. For example, the backend pdf could be satisfied by Asciidoctor PDF, but it may also be mapped to a different implementation. The last converter that registers itself with a backend wins. Convert Your First File Available Converters Asciidoctor Home --> Docs Chat Source List (archive) @asciidoctor Copyright © 2026 Dan Allen, Sarah White, and individual Asciidoctor contributors. Except where noted, the content is licensed under a Creative Commons Attribution 4.0 International (CC BY 4.0) license. The UI for this site is derived from the Antora default UI and is licensed under the MPL-2.0 license. Several icons are imported from Octicons and are licensed under the MIT license. AsciiDoc® and AsciiDoc Language™ are trademarks of the Eclipse Foundation, Inc. Thanks to our backers and contributors for helping to make this project possible. Additional thanks to: Authored in AsciiDoc . Produced by Antora and Asciidoctor .
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/category%20theory
don't count on finding me: category theory skip to main | skip to sidebar don't count on finding me Showing posts with label category theory . Show all posts Showing posts with label category theory . Show all posts Friday, December 10, 2010 The Sky was the Limit Everyone remembers Tom Petty's song 'Into the Great Wide Open' with it's famous refrain The sky was the limit I was thinking about limits (the category theory ones) for many years now, but could never really visualize the concept. (I should really start reading Awodey's 'Category Theory' which will be my present to self at Xmas.) I tried to get hold of the related problems with a mental construction of a lazy, self-building thrist. It was clear that each element should increase the type, Z , (S Z) , (S (S Z)) , etc. ad infinitum, so the start type would be clear: Thrist Up Z ? . But the ? , let's call it the limit, is not clear at all. Anyway it would be an infinite type, not like in the simple analogy of let count = 0 : count in count , where count :: [Int] holds. As we know type checkers do not like infinite types, as it would take forever and two days to check them :-) Fortunately the sky is not a limit anymore and I came up with a solution that is nice and short even in Ωmega, which is a strict language (albeit with a lazy construct). Since it is only a few lines I can effortlessly reproduce it here. data Count :: Nat ~> Nat ~> * where   Incr :: Nat' n -> Count n (1+n)t The Incr constructor states the typing rule, namely one higher to the right than to the left. We can try it out: prompt> [Incr 0v, Incr 1v, Incr 2v]l [(Incr 0v),(Incr 1v),(Incr 2v)]l : Thrist Count 0t 3t Not surprisingly, this is the only value of type  Thrist Count 0t 3t . We follow the example of count above and write: a = [Incr 0v; lazy (shift a)]l Naturally shift will shift a Count thrist to the right, thus satisfying the type constraint of thrists, that at each joining point the left and right types must match up. The  lazy  keyword is needed here to delay the evaluation, it is however pointless in Haskell. All that remains is to write the  shift  function which will create the ominous limit type: shift :: Thrist Count n a -> Thrist Count (1+n)t a shift [Incr n; r]l = [Incr (1+n)v; lazy (shift r)]l It is probably not a surprise that the limit value is ⊥ (i.e. nonexistent), so any type will do (along the constraints of the kind in question). I settled with a universal type. Now we can pattern match on a to see that it really grows into the sky: case a of {[a,aa,aaa,aaaa; b]l -> show b} prints  "[(Incr 4v) ; ...]l" thanks to show 's magic. The  ...  corresponds to the suspended computation. Hey, it wasn't that hard at all! Where is the infinite type? It is hidden behind the existential barrier that is formed at each thrist joining point, and since it cannot escape we do not have to worry it... Good night! Posted by heisenbug at 3:09 PM No comments: Labels: category theory , haskell , omega , thrist Thursday, November 8, 2007 Trendy Topics There seem to be two important trends in the Haskell universe and I must admit, that I do not want to stay away from them either... The first one is the exploration of category-theoretic concepts and their showing-off in the blogosphere. Generalizations of monads or the category type class are just two recent picks from the bottomless supply of ideas . The second trend is more subtle and one has to dive into the recent ICFP papers to perceive it. I have already mentioned the Unimo framework, which guarantees the monad laws and allows to represent the monadic computation as a pure data structure which is then run by recursive analysis. Wouter Swierstra et al. introduced another concept to capture monads (also strongly resembling the free monad ) and they have improved testing ability on their minds when doing this. The third paper that comes to my mind is about speeding up arrow computations by analysis and optimization of a data structure closely resembling arrows . So I am not in bad company announcing that I am preparing a paper about thrists which are the moral equivalents of free categories . The rest of this article gives an appetizer about thrists. data Thrist :: (* -> * -> *) -> * -> * -> * where Nil :: Thrist p a a Cons :: p a b -> Thrist p b c -> Thrist p a c The definition makes it clear that Thrist is a GADT (I use the Haskell way of defining a GADT here, the paper will use the slightly different Ωmega syntax) and it is a curious mixture of listness and threadedness (this is the reason for its name). The types of the thrist elements must match up in a certain way, resembling function composition. Indeed, instead of composing functions, we can put them into a thrist: Cons ord $ Cons chr Nil gives us an arrow thrist ( Thrist (->) Char Char ) only showing the start and end types, with the internal types abstracted away existentially. Of course we have to supply an interpreter for this data structure to get the functionality (the semantics ) of function composition, but this easy exercise is left to you. But... What do thrists buy us? Two very important things: Unlike function composition, we can take the thrist apart, analyse and transform it, and a vast field opens up with the first ( p ) parameter to the Thrist . It can be the pair constructor (,) or the LE (less-or-equal) proposition, there are many sensible instantiations -- especially with two-parameter user-defined GADTs. Finally, the category-theoretic twist: think of the parameter p as the morphisms of a category C (with C 's objects being the morphisms' domains and ranges) then Thrist p is essentially the free category of C , often written as C* . I hope you enjoyed reading this in the same way as me writing it! Posted by heisenbug at 1:23 PM 4 comments: Labels: category theory , haskell , monads , omega , thrist Wednesday, September 12, 2007 Comonads Slowly recovering from vacation-induced ignorance, today I printed out some interesting papers about type-preserving compilation , plans for type-level functions in GHC and dataflow implementations using comonads . Another one about Hoare Type Systems remained on my screen, too heavy for me, a.t.m. So I am wrapping my head around category theory again. Somehow all these topics seems to interact, and I continuously am trying to fit them into my Thrist framework. Today I tried to implement a Comonad to Thrist adapter (in my mind at least, no code written yet). Posted by heisenbug at 4:50 PM No comments: Labels: category theory , types Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/applicative
don't count on finding me: applicative skip to main | skip to sidebar don't count on finding me Showing posts with label applicative . Show all posts Showing posts with label applicative . Show all posts Saturday, November 27, 2010 Applicative Structures and Thrists I've been toying with the idea of furnishing the the applicative framework into thrist-like clothing , with early attempts here . Last night I might have gotten it, finally... Here is the idea. Since function application is left-associative, but thrists are right associative, I'll reverse the application's direction to right-to-left, i.e. f a b c will become c b a f . This uglyness is another reason to finally whip up a RevThrist , which would be SNOC-like and left-associative. We need following ingredients: Fun - functions perform the reduction to a new object, Arg - arguments successively saturate the applicable structure to the right, Par - partial application (or parent) initiates the reduction. I'll explain these elements next, but first rewrite the above expression a bit to get a parentesized form (c(b(a f))) , and now with roles marked up in thrist syntax: Cons (Arg c) $ Cons (Arg b) $ Cons (Arg a) $ Cons (Fun f) Nil Looks almost reasonable. Time to define the ingredients mentioned above. Remember, that it must be a two-parameter data type and that the types must match up between Arg c and Arg b , etc., and finally between Arg a and Fun f . This is a pretty hefty requirement! We can attempt passing the effective application type between the ingredients, defining the data structure as data Appli :: * → * → * where   Fun :: (a → b) → Appli (a → b) c   Arg :: a → Appli b (a → b) This means functions pass their own type to the left (and ignoring what comes from the right), while arguments expect a saturable effective type from the right, store an appropriate value and propagate the remaining type to the left. This should work now: Cons (Arg 'a') $ Cons (Fun ord) Nil , with the type being Thrist Appli Int c . As you can see, no function type gets passed to the left, so you cannot prepend any more arguments. But this all appears useless since we cannot nest things. The Par ingredient will take care of this: Par :: Thrist Appli a c → Appli b (a → b) Par has a double role, it acts just like an argument, but holding a thrist inside, and thus groups a sub-application. The c type variable occurring in Par and Fun troubled me a lot, because it allows building up illegal thrists. Consider Cons (Fun f) $ Cons (Fun f) Nil . This gibberish cannot be assigned any reasonable semantics! Finally it occurred to me to use a phantom type for filling in this breach: data Peg Since Peg is uninhabited, no function signature can include it (unless it is a divergent one). It also ensures that the leftmost ingredient in a thrist is a function, how practial for Par ! Anyway, our Appli is done now: data Appli :: * → * → * where   Fun :: (a → b) → Appli (a → b) Peg   Arg :: a → Appli b (a → b)   Par :: Thrist Appli a Peg → Appli b (a → b) So what brave soul will try this out? Because I must confess, up to this point I've been too lazy to fire up GHC! You might be inclined to say, why this whole circus? An awkward notation for something as simple as function application? Any Haskell implementation can do this with a beautiful syntax! Yes, we can build up applications but can't even compute them. This is a toy at the moment. But try to pull apart an application in Haskell! You can't! Here you can add an evaluator ( foldlThrist ?) and also instrument, trace, debug your evaluation process. Also, there is a reason I say 'Applicative Structures' in the title. Here is a generalization of Appli that is parametrized: data Appli :: ( * → * → * ) → * → * → * where   Fun :: (a ~> b) → Appli ( ~> ) (a ~> b) Peg   Arg :: a → Appli ( ~> ) b (a ~> b)   Par :: Thrist (Appli ( ~> )) a Peg → Appli ( ~> ) b (a ~> b) You are free now to create your own function and value space with attached typing rules and still be able to use Thrist (Appli MySpace) ... The possibilities are endless, e.g. encrypted execution on remote hosts or abstract interpretation, you say it. Have Fun ! Posted by heisenbug at 6:37 AM No comments: Labels: applicative , haskell , thrist Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2010/06/sized-types.html
don't count on finding me: Sized types skip to main | skip to sidebar don't count on finding me Friday, June 18, 2010 Sized types I have always liked the idea of assigning some notion of size to (tree-like) values, and track its changes along pattern matching and construction to be able to reason about termination-unaffecting recursive calls. Many years ago, when reading the Hughes-Pareto-Sabry paper I did not see the point yet why termination is fundamental in various aspects. Only when sitting on the park bench on the isle of Margitsziget (Budapest) and discussing with Tim about sound logic in Ωmega, it dawned to me how termination checking with sized types can be exploited. I developed the intuition of the tree-like data floating heads down in the water and we are reasoning about criteria that it can still float without touching the ground at depth n . Still, this metaphor was rather hazy. In the meantime I have tried to digest the relevant papers from Barthe and Abel, brainstormed somewhat here and let my brain background. Yesterday, I found (on reddit) a link to Abel's new MiniAgda implementation and its description. It made clear to me that my early intuition was not bad at all, the water depth is the upper limit of the size, and recursion is to reduce this to obtain a well-founded induction. Now it is time to rethink my ideas about infinite function types and how they can be reconciled with sized types. But it looks like Abel has done the hard work and his Haskell implementation of MiniAgda could be married with Ωmega in the following way: Derive a sized variant of every (suitable) Ωmega datatype and try to check which functions on them terminate. These can be used as theorems in Ωmega. Hopefully Tim is paying attention to this when implementing Trellys... Posted by heisenbug at 12:01 PM Labels: omega , termination , types No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ▼  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ▼  June (4) Emacs the Lifesaver Burning ISO CDs Sized types My grief with out-of-tree code ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/optimization
don't count on finding me: optimization skip to main | skip to sidebar don't count on finding me Showing posts with label optimization . Show all posts Showing posts with label optimization . Show all posts Monday, July 9, 2007 More on Tail Merging In an earlier post I speculated that factoring out Cat combinators other than Dup would just be a matter of copy-and-paste (I used the euphemism boilerplate back then). It came to me as a shocking revelation that the Ωmega interpreter did not agree. It asserted that type _d is equated to type _e which is inacceptable. The error message was not exactly like this, but very similar. It took me some time to understand it. First I wrote an even shorter function than the one-liner that caused the error. It only happened when I recombined the two shortened If legs (that is, after removing a Print from each). This piqued my curiosity and I made an excursion into Ωmega's interactive typecheck mode , just to discover that the two If legs ended with different stack configurations! This put me over the top, and I could come up with an example immediately: If [Push 42, Print] [Push True, Print] is a case where the Print cannot be removed without violating the invariant that the exit stack configurations at both If legs must be the same. In this case the yes-leg would have an Int at TOS and the no-leg a Bool . Since I have to cater for the general case, the removal of a Print is unsound. Ωmega discovered this. There are two lessons to be learned from this incident, namely: If you see a mysterious error (message), simply provoke the same with a smaller program, and Ωmega's error messages need to be improved in a way that somehow the piece of code is indicated that gives rise to the erroneous types. In the meantime I have an idea how to find a way to remove that Print anyway. The key is abstract interpretation of the two If legs, to construct a proof that the stacks have the same shape immediately before the Print . Given this proof the typechecker can be persuaded to allow the recombination of the shortened legs. But to implement this idea there are many more hours to be spent hacking. It will surely be worth blogging about. Posted by heisenbug at 3:01 PM No comments: Labels: omega , optimization Saturday, July 7, 2007 Tail Merging in Ωmega Today finally I got around improving my Cat-like language optimizer with a new twist: I can finally factor out common instructions from the end of the two If legs and prepend them to the If 's continuation. This wouldn't be an interesting achievement if it wouldn't be written in Ωmega 's type-pedantic fragment. To wit: tailMerge False [If [Dup]l [Dup]l, Print]l (revThrist' [Dup]l) (revThrist' [Dup]l) [Print]l becomes: [(PopN 1v),Dup,Print]l : forall a (b:Prod *0).Thrist Cat [Bool,a; b]sh [a; b]sh If you think the above lines are in Chinese, you can stop now. If you discover that the If has completely been eliminated and replaced by popping a boolean and duplicating the TOS , then you are pretty good in reading obscure code. The funny thing is that all the types of values that are on the stack are painstakingly tracked, and the transformation is automatically type correct in Cat because it is type checked in the metalanguage . I am sure that similar transformations have been proven type correct (and thus pretty correct) before, however I would like to know whether this particular optimization has been already formalized using expressive types. The big surprise for me was the fact that writing down the transformation only needed a dozen lines of code, support functions included. Of course, my proof of concept only matches on Dup instructions, but the rest is basically boilerplate. The second surprise is, that so far I did not need a single theorem declaration, an indication that either I am still in very shallow waters regarding the power of Ωmega's typechecker, or my Thrist construction is so clever that it provides enough type hints to the narrowing engine to deduce all types. I am in the process of writing a paper on all this, and - as always - need some encouragement. Tail merging will definitely belong to the beef part of it. Posted by heisenbug at 4:18 PM No comments: Labels: omega , optimization , types Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/types?updated-max=2007-07-07T16:18:00-07:00&max-results=20&start=20&by-date=false
don't count on finding me: types skip to main | skip to sidebar don't count on finding me No posts with label types . Show all posts No posts with label types . Show all posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2007/09/comonads.html
don't count on finding me: Comonads skip to main | skip to sidebar don't count on finding me Wednesday, September 12, 2007 Comonads Slowly recovering from vacation-induced ignorance, today I printed out some interesting papers about type-preserving compilation , plans for type-level functions in GHC and dataflow implementations using comonads . Another one about Hoare Type Systems remained on my screen, too heavy for me, a.t.m. So I am wrapping my head around category theory again. Somehow all these topics seems to interact, and I continuously am trying to fit them into my Thrist framework. Today I tried to implement a Comonad to Thrist adapter (in my mind at least, no code written yet). Posted by heisenbug at 4:50 PM Labels: category theory , types No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ▼  2007 (20) ►  December (2) ►  November (1) ►  October (1) ▼  September (1) Comonads ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2010/11/patterns-and-existentials.html
don't count on finding me: Patterns and Existentials skip to main | skip to sidebar don't count on finding me Thursday, November 25, 2010 Patterns and Existentials I am reading papers again and this always activates my creative fantasy. I want to explain a small revelation I had just now. Patterns are the same thing as declaring existential values corresponding to all pattern variables according to their respective types as stated in their respective constructors and asserting that the pattern interpreted as a value is the same as the scrutinee. The body behind the pattern in turn is similarly evaluated with the existential variables in scope. Of course the existential values are filled in by some oracle which is uninteresting from the typing perspective. A strong corollary of the asserted value identity is that we can also assert that the type of the scrutinee unifies with the type of the pattern-value (in the scope of the existentials, but not outside of it)! Just as universally quantified values are typed by dependent products (∏-stuff) the existentially quantified values are typed by dependent sums (∑-stuff). Note that the stuff is at stratum 1, e.g. types. This is in contrast to the Haskell data declaration data Foo = forall a . Foo a where a is at stratum 1, being an existential type . Hmm, when thinking this to the end we may either end up at the conventional non-inference for GADTs or something like the generalized existentials as proposed in Chuan-kai Lin's thesis. I conjecture also that this is the same thing as the post-facto type inference I suggested here . Now all remains to is to reinterpret function calls as a data type being a tuple with existential values and to apply the above trick. Posted by heisenbug at 2:21 PM Labels: crazy , GADT , haskell No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ▼  2010 (19) ►  December (5) ▼  November (6) More on Existentials Applicative Structures and Thrists Type Synonyms Generalized Patterns and Existentials Hats off Cooperation ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2010/11/more-on-existentials.html
don't count on finding me: More on Existentials skip to main | skip to sidebar don't count on finding me Saturday, November 27, 2010 More on Existentials In a previous post I suggested a new (?) interpretation for pattern variables in case branches. This post is my way to understand matters more. Let's start with the basic example data Temp :: * where   Kelvin :: Float -> Temp Then Kelvin 273.2 is about the temperature at which water freezes (or dually, thaws). Okay, let's demonstrate my point by this code: diff :: Temp -> Temp -> Bool diff (Kelvin a) (Kelvin b) = a == b test t = case t of { Kelvin a -> diff t (Kelvin a) } What do you expect the function test is? Yes, the const True one! The explanation is simple, as we are in a referentially transparent context, destructuring a value by pattern matching and reconstructing it the same way from its parts creates a value undistinguishable from the original. This of course means that diff will not be able to detect a difference. Let's switch to a different interpretation. Some oracle invokes the case branch and says: I am not allowed to tell you what it is but here is a Float named a and you can assume that Kelvin a is indistinguishable from t ! Look ma, no 'pattern matching' or 'destructuring' needed! a may contain 3.14 or 3.15 or 100.1 or ..., ad infinitum, we simply do not know. But we know that it names a Float ! It exists as a Float . Mathematically the case branch can be written as ∃ a : Float ( t ≡ Kelvin a ) . diff t (Kelvin a) which is the english phrase "compute diff t (Kelvin a) under the assumption that there is a Float -valued number that when passed to the function Kelvin becomes undistinguishable from the case scrutinee". After seeing the same thing in three languages we have to reformulate it one more time. Into logic, that is the language of type theory . Types are propositions and any value one type inhabit proves the corresponding proposition. The existential quantifier (∃) above gets mapped to a dependent sum that is the input to the computation t : Temp ⊦ 〈a : Float, proof : SomeProp(t, a)〉. diff t (Kelvin a) I took this formulation (and other wisdom) from Appendix A of Steve Awodey's recent paper . This part unfortunately is not my strongest side. My best guess is that SomeProp(t, a) is a type that encodes the same ness fact, and depends on a. Moreover, proof is an inhabitant of that type. The  〈a : Float, proof : SomeProp(t, a)〉 construct binds two existential variables. The I hope to come up with a nicer formulation sometime. ( Please comment if I got something wrong, thanks! ) After understanding this, we can advance to more involved issues, namely one level higher. Take a look at this gorgeous definition: data Ex :: * where   Hide :: a -> Ex This is a pretty useless data type but should be sufficient for my purposes. Then we need a function that pattern matches on it: f :: Ex -> Bool f e = case e of { Hide it -> True } We see that pattern matching unhides the hidden value. It is said that it receives an existential type in the case branch where it is bound. But you will see no type annotation on it , ever. So, what happens in the case branch this time? While the type of it might have been known at the moment of construction, at this point the type system does not know it. So it is assumed to have some type t . After giving our unknown a name (thus qualifying it existentially) we can ponder about the value of it . This is something we have explored above already, so we can reformulate the case branch mathematically like follows: ∃a:* (true) . ∃ it :a (e ≡ Hide it ) . True The first qualifier has just a trivial condition attached to it, I believe I could also have omitted it. I am on pretty thin ice at this point so I'll refrain from giving a type-theoretic transcription, but you can imagine that there will be two dependent sum binders where the first enters in the second in the classifier position . One more closing thought on the oracles involved. They sound mysterious but they aren't at all. For example in Ωmega the oracle for values it the reduction machinery for runtime values. It is obvious how this machinery is able to look into closures and deconstruct instances of polynomial datatypes. On the type (also kind and up) level, however Ωmega resorts to narrowing , an evaluation mechanism usually employed in logic programming. In the typing rules these mechanisms do not have a place, thus how the variables get bound remains elusive to those. Posted by heisenbug at 4:27 PM Labels: dependent types , haskell , logic No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ▼  2010 (19) ►  December (5) ▼  November (6) More on Existentials Applicative Structures and Thrists Type Synonyms Generalized Patterns and Existentials Hats off Cooperation ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
https://github.com/deivid-rodriguez
deivid-rodriguez (David Rodríguez) · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection Stop leaks before they start EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events & webinars Ebooks & reports Business insights GitHub Skills SUPPORT & SERVICES Documentation Customer support Community forum Trust center Partners Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} deivid-rodriguez Follow Overview Repositories 242 Projects 0 Packages 1 Stars 420 More Overview Repositories Projects Packages Stars deivid-rodriguez Follow David Rodríguez deivid-rodriguez Follow Sponsor Open source paramedic 1.3k followers · 24 following @tidelift Madrid, Spain 10:30 (UTC +01:00) Mastodon @deividrodriguez@mastodon.social Sponsors Achievements x2 x4 x4 x3 Achievements x2 x4 x4 x3 Organizations Block or Report Block or report deivid-rodriguez --> Block user Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users . You must be logged in to block users. Add an optional note Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you. Block user Report abuse Contact GitHub support about this user’s behavior. Learn more about reporting abuse . Report abuse Overview Repositories 242 Projects 0 Packages 1 Stars 420 More Overview Repositories Projects Packages Stars deivid-rodriguez / README .md Hi there 👋 🤷‍♂️ My name is David Rodríguez, but usually people call me Deivid. 🔭 I’m a former maintainer of the official package managers for the Ruby language, Bundler & RubyGems , until Ruby Central kicked me out. The only reason I can think of for this is that, when I was informed that they would unilaterally remove fellow maintainers from the project in order to keep funds from Shopify, I was very critical of that decision. Because I honestly think I did a good job. 🌴 Currently trying to figure out what I should do next. 🐛 I love fixing bugs and making software more stable and less surprising. I care a lot about backwards compatibility and try to be empathetic towards the users of the software I develop. 📆 In the past I've worked as a freelance software engineer implementing new features and improving several open source Ruby projects, such as the participatory democracy framework decidim , which gave me good understanding of the Rails framework, or Github's Dependabot Updates , where I learnt about common challenges and particularities of the different package manager ecosystems. 🤓 I have a bachelor's degree in Mathematics, but I don't really recall much about that 😅. 💪🏼 I try pretty hard to not be a shitty person, which is kind of the new cool thing to be these days. Pinned Loading byebug byebug Public Debugging in Ruby Ruby 3.4k 324 pry-byebug pry-byebug Public Step-by-step debugging and stack navigation in Pry Ruby 2k 144 activeadmin/ activeadmin activeadmin/activeadmin Public The administration framework for Ruby on Rails applications. Ruby 9.7k 3.3k openfoodfoundation/ openfoodnetwork openfoodfoundation/openfoodnetwork Public Connect suppliers, distributors and consumers to trade local produce. Ruby 1.2k 762 Something went wrong, please refresh the page to try again. If the problem persists, check the GitHub status page or contact support . Uh oh! There was an error while loading. Please reload this page . Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2007/07/tail-merging-in-mega.html
don't count on finding me: Tail Merging in Ωmega skip to main | skip to sidebar don't count on finding me Saturday, July 7, 2007 Tail Merging in Ωmega Today finally I got around improving my Cat-like language optimizer with a new twist: I can finally factor out common instructions from the end of the two If legs and prepend them to the If 's continuation. This wouldn't be an interesting achievement if it wouldn't be written in Ωmega 's type-pedantic fragment. To wit: tailMerge False [If [Dup]l [Dup]l, Print]l (revThrist' [Dup]l) (revThrist' [Dup]l) [Print]l becomes: [(PopN 1v),Dup,Print]l : forall a (b:Prod *0).Thrist Cat [Bool,a; b]sh [a; b]sh If you think the above lines are in Chinese, you can stop now. If you discover that the If has completely been eliminated and replaced by popping a boolean and duplicating the TOS , then you are pretty good in reading obscure code. The funny thing is that all the types of values that are on the stack are painstakingly tracked, and the transformation is automatically type correct in Cat because it is type checked in the metalanguage . I am sure that similar transformations have been proven type correct (and thus pretty correct) before, however I would like to know whether this particular optimization has been already formalized using expressive types. The big surprise for me was the fact that writing down the transformation only needed a dozen lines of code, support functions included. Of course, my proof of concept only matches on Dup instructions, but the rest is basically boilerplate. The second surprise is, that so far I did not need a single theorem declaration, an indication that either I am still in very shallow waters regarding the power of Ωmega's typechecker, or my Thrist construction is so clever that it provides enough type hints to the narrowing engine to deduce all types. I am in the process of writing a paper on all this, and - as always - need some encouragement. Tail merging will definitely belong to the beef part of it. Posted by heisenbug at 4:18 PM Labels: omega , optimization , types No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ▼  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ▼  July (14) Taming PSNormalizer Taming Distiller Endo at end? Ωmega Tutorial Posted A Compiler with a Good Clang Writing Papers is Hard Heating up for ICFP Contest The HaL2 Harvest More on Tail Merging The Grief with "Greif" Tail Merging in Ωmega Haskell in Leipzig Committed to LLVM How to start? About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2010/11/type-synonyms-generalized.html
don't count on finding me: Type Synonyms Generalized skip to main | skip to sidebar don't count on finding me Thursday, November 25, 2010 Type Synonyms Generalized Type functions are the new trend. Ωmega has them with the following syntax: tfun :: Nat ~> Nat {tfun Z} = S Z Haskell (that is GHC) has them in the flavor of type families. It has just occurred to me that they can be considered as a syntactic relaxation of type synonyms! Look: tfun :: Nat ~> Nat type tfun Z = S Z type tfun (S n) = Z When conventional type synonyms are used they must be fully applied. This should be the case here too. I am not sure whether type families or Ωmega-style type functions can be partially applied, though. Anyway, a bit more to write at the definition site but less curlies to type at the call site; it may well be worth it. Posted by heisenbug at 3:06 PM Labels: crazy , haskell , omega No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ▼  2010 (19) ►  December (5) ▼  November (6) More on Existentials Applicative Structures and Thrists Type Synonyms Generalized Patterns and Existentials Hats off Cooperation ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/GADT
don't count on finding me: GADT skip to main | skip to sidebar don't count on finding me Showing posts with label GADT . Show all posts Showing posts with label GADT . Show all posts Thursday, November 25, 2010 Patterns and Existentials I am reading papers again and this always activates my creative fantasy. I want to explain a small revelation I had just now. Patterns are the same thing as declaring existential values corresponding to all pattern variables according to their respective types as stated in their respective constructors and asserting that the pattern interpreted as a value is the same as the scrutinee. The body behind the pattern in turn is similarly evaluated with the existential variables in scope. Of course the existential values are filled in by some oracle which is uninteresting from the typing perspective. A strong corollary of the asserted value identity is that we can also assert that the type of the scrutinee unifies with the type of the pattern-value (in the scope of the existentials, but not outside of it)! Just as universally quantified values are typed by dependent products (∏-stuff) the existentially quantified values are typed by dependent sums (∑-stuff). Note that the stuff is at stratum 1, e.g. types. This is in contrast to the Haskell data declaration data Foo = forall a . Foo a where a is at stratum 1, being an existential type . Hmm, when thinking this to the end we may either end up at the conventional non-inference for GADTs or something like the generalized existentials as proposed in Chuan-kai Lin's thesis. I conjecture also that this is the same thing as the post-facto type inference I suggested here . Now all remains to is to reinterpret function calls as a data type being a tuple with existential values and to apply the above trick. Posted by heisenbug at 2:21 PM No comments: Labels: crazy , GADT , haskell Tuesday, November 23, 2010 Hats off The types subreddit references Chuan-kai Lin's PhD thesis about GADT type inference. I already have read the pointwise paper , but this is of course a revelation. He actually did implement an algorithm that inferred types for 25 (out of 30) little benchmark programs with GADTs. Previous attempts accomplished at most one! But the thing that impressed me the most wasn't the technical side of his story but the beautifully crafted slides of his PhD defense talk. I am baffled... Congratulations Chuan-kai! Posted by heisenbug at 6:09 PM No comments: Labels: GADT , types Tuesday, March 3, 2009 3^2 Day Today is 3^2 day, because 3 squared is 9 and today's date is 03.03.09. Number jokes aside, it was a good day, I am finally beginning the implementation part of my new project at work and the ideas keep sprouting. Good. PS.: Also I found a nice article about decidable type inference for GADTs. Final version hopefully for ICFP09! Posted by heisenbug at 2:55 PM No comments: Labels: GADT , good Thursday, January 31, 2008 Embeddings, Part One: Arrow --> Thrist Dan Weston asked me how the embeddings of arrows and monads into thrists would look like. Took me some effort, but I think I have found something that appears to be satisfactory. This time I shall prove my claim that in Haskell any Control.Arrow instance can be rewritten as a Thrist data structure. I shall also provide a semantics for the resulting data that shall recover the original arrow. Let me recapitulate the Thrist definition before diving in: data Thrist :: (* -> * -> *) -> * -> * -> * where Nil :: Thrist p a a Cons :: p a b -> Thrist p b c -> Thrist p a c Let's begin with the embedding part. Since the members of thrists are constructors of a two-parameter GADT, we have to construct the Arrow' GADT first. Here is the adapter: data Arrow' :: (* -> * -> *) -> * -> * -> * where Arr :: Arrow a => a b c -> Arrow' a b c First :: Arrow a => Arrow' a b c -> Arrow' a (b, d) (c, d) Arr takes any arrow and wraps it. This constructor is responsible for the actual embedding and it is easy to see that it is completely general. First is responsible for defining a transformation on a pair's first component. Clearly this corresponds to the Arrow type class's first member. I refrain from doing the same to the other functions in the Arrow type class. You may scratch your head now, asking whether I have forgotten to handle the >>> member... The answer is no , I'll come back to this later. Let's see how this works out in the practice... t1 :: Thrist (->) Char Char t1 = Cons ord (Cons chr Nil) This is just the plain chaining of functions as a thrist. Here is the Arrow' embedding: t2 :: Arrow' (->) Char Int t2 = Arr ord We make a thrist of length 1: t3 :: Thrist (Arrow' (->)) Char Int t3 = Cons t2 Nil This is bit more involved, adding a constant second pair component: t4 :: Arrow' (->) a (a, Int) t4 = Arr (\a -> (a, 42)) Now it is time to form a longer thrist: t5 :: Thrist (Arrow' (->)) Int (Int, Int) t5 = Cons (Arr chr) (Cons t4 (Cons (First t2) Nil)) So, this corresponds to what? Intuitively, it could mean chr >>> (\a -> (a, 42)) >>> first ord . The Cons data constructor assumes the rôle of >>> . To obtain a meaning at all, we have to define a semantics for it! Here it comes, and allows us to recover the embedded arrow: recover :: Arrow a => Thrist (Arrow' a) b c -> a b c recover Nil = arr id recover (Cons (Arr f) r) = f >>> recover r recover (Cons (First a) r) = first (recover $ Cons a Nil) >>> recover r Some people call this an (operational) interpreter. Finally, a little test: *Embeddings> (recover t5) 55 Loading package haskell98 ... linking ... done. (55,42) Cute, isn't it? PS: To embed monads, you can try embedding them via Kleisli to obtain an arrow and then via Arrow' to construct a thrist. Alternatively wait for a future post here :-) PPS: For running the above you will need these preliminaries: module Embeddings where import Prelude import Control.Arrow import Char Posted by heisenbug at 1:06 PM No comments: Labels: GADT , haskell , thrist Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
https://stdapi.ai/use_cases_langchain/
LangChain / LlamaIndex integration - stdapi.ai Skip to content stdapi.ai LangChain / LlamaIndex integration Initializing search stdapi-ai/stdapi.ai Home Documentation API Reference stdapi.ai stdapi-ai/stdapi.ai Home Documentation Documentation API API Overview OpenAI Compatible Operations Operations Getting started Configuration Licensing Logging & Monitoring Use cases Use cases Overview OpenWebUI integration N8N integration IDE integration (Continue.dev & others) LibreChat integration LangChain / LlamaIndex integration LangChain / LlamaIndex integration Table of contents About LangChain & LlamaIndex Why LangChain/LlamaIndex + stdapi.ai? Prerequisites 🐍 LangChain Python Integration Installation Basic Chat Model Setup Embeddings for RAG Complete RAG Pipeline Agents and Tools 🦙 LlamaIndex Python Integration Installation Basic Setup Document Indexing and Query 🟨 LangChain JavaScript/TypeScript Integration Installation Basic Chat Model Setup RAG with LangChain.js 💡 Common Patterns and Best Practices Environment Variables Streaming Responses Retry Logic and Error Handling 📊 Model Recommendations 🔧 Migration from OpenAI 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Note-taking apps (Obsidian & Notion) Chat bots (Slack, Discord & Teams) Autonomous agents (AutoGPT & more) Roadmap & Changelog API Reference Table of contents About LangChain & LlamaIndex Why LangChain/LlamaIndex + stdapi.ai? Prerequisites 🐍 LangChain Python Integration Installation Basic Chat Model Setup Embeddings for RAG Complete RAG Pipeline Agents and Tools 🦙 LlamaIndex Python Integration Installation Basic Setup Document Indexing and Query 🟨 LangChain JavaScript/TypeScript Integration Installation Basic Chat Model Setup RAG with LangChain.js 💡 Common Patterns and Best Practices Environment Variables Streaming Responses Retry Logic and Error Handling 📊 Model Recommendations 🔧 Migration from OpenAI 🚀 Next Steps & Resources Getting Started Learn More Community & Support ⚠️ Important Considerations Home Documentation Use cases LangChain / LlamaIndex Integration ¶ Build AI applications with LangChain and LlamaIndex using Amazon Bedrock models through stdapi.ai. Keep your existing code—just point it to stdapi.ai and access Claude, Amazon Nova, and all Bedrock models with zero code changes. About LangChain & LlamaIndex ¶ 🔗 LangChain: Website | Python Docs | JS/TS Docs | GitHub | Discord 🔗 LlamaIndex: Website | Documentation | GitHub | Discord Popular frameworks for building AI applications: LangChain - 90,000+ GitHub stars, comprehensive framework for chains, agents, and RAG LlamaIndex - 35,000+ GitHub stars, specialized for data indexing and retrieval Both support Python, JavaScript/TypeScript, and multiple LLM providers Production-ready - Used by companies building AI products Why LangChain/LlamaIndex + stdapi.ai? ¶ Drop-In Compatibility Both frameworks are designed to work with OpenAI's API, making stdapi.ai a drop-in replacement for Amazon Bedrock models without changing your application code. Key Benefits: Zero code changes - Change one parameter (base_url) to switch providers Keep your codebase - All existing LangChain/LlamaIndex code works as-is Access Claude, Amazon Nova, and all Bedrock models Use chains, agents, retrievers, and all framework capabilities AWS pricing instead of OpenAI rates Your data stays in your AWS environment Work in Progress This integration guide is actively being developed and refined. While the configuration examples are based on documented APIs and best practices, they are pending practical validation. Complete end-to-end deployment examples will be added once testing is finalized. Prerequisites ¶ What You'll Need Before you begin, make sure you have: ✓ Python 3.8+ or Node.js 18+ (depending on your language) ✓ LangChain or LlamaIndex installed ✓ Your stdapi.ai server URL (e.g., https://api.example.com ) ✓ An API key (if authentication is enabled) ✓ AWS Bedrock access configured with desired models 🐍 LangChain Python Integration ¶ Installation ¶ Install LangChain # Install LangChain with OpenAI support pip install langchain langchain-openai # For RAG applications, also install: pip install langchain-community chromadb Basic Chat Model Setup ¶ Replace OpenAI with stdapi.ai in your LangChain applications. Python - Basic Chat from langchain_openai import ChatOpenAI # Configure chat model to use stdapi.ai llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = "your_stdapi_key_here" , openai_api_base = "https://YOUR_SERVER_URL/v1" , temperature = 0.7 ) # Use it like any LangChain model response = llm . invoke ( "Explain quantum computing in simple terms" ) print ( response . content ) Available Models: Use any Amazon Bedrock chat model by specifying its model ID. Popular choices include Claude Sonnet, Claude Haiku, Amazon Nova Pro, Amazon Nova Lite, Amazon Nova Micro, and any other Bedrock models available in your region. Embeddings for RAG ¶ Use Amazon Bedrock embeddings for semantic search and RAG applications. Python - Embeddings from langchain_openai import OpenAIEmbeddings from langchain_community.vectorstores import Chroma from langchain.text_splitter import RecursiveCharacterTextSplitter # Configure embeddings to use stdapi.ai embeddings = OpenAIEmbeddings ( model = "amazon.titan-embed-text-v2:0" , openai_api_key = "your_stdapi_key_here" , openai_api_base = "https://YOUR_SERVER_URL/v1" ) # Example: Create vector store from documents documents = [ "Your document text here..." , "Another document..." ] # Split documents into chunks text_splitter = RecursiveCharacterTextSplitter ( chunk_size = 1000 , chunk_overlap = 200 ) chunks = text_splitter . create_documents ( documents ) # Create vector store vectorstore = Chroma . from_documents ( documents = chunks , embedding = embeddings ) # Query the vector store results = vectorstore . similarity_search ( "your query here" , k = 3 ) Available Embedding Models: Amazon Titan Embed Text v2 — amazon.titan-embed-text-v2:0 (recommended, 8192 dimensions) Amazon Titan Embed Text v1 — amazon.titan-embed-text-v1 (legacy, 1536 dimensions) Cohere Embed — If enabled in your AWS region Complete RAG Pipeline ¶ Build a full RAG application with stdapi.ai. Python - RAG Application from langchain_openai import ChatOpenAI , OpenAIEmbeddings from langchain_community.vectorstores import Chroma from langchain.chains import RetrievalQA from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.document_loaders import TextLoader # 1. Configure LLM llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = "your_stdapi_key_here" , openai_api_base = "https://YOUR_SERVER_URL/v1" , temperature = 0 ) # 2. Configure embeddings embeddings = OpenAIEmbeddings ( model = "amazon.titan-embed-text-v2:0" , openai_api_key = "your_stdapi_key_here" , openai_api_base = "https://YOUR_SERVER_URL/v1" ) # 3. Load and process documents loader = TextLoader ( "path/to/your/documents.txt" ) documents = loader . load () text_splitter = RecursiveCharacterTextSplitter ( chunk_size = 1000 , chunk_overlap = 200 ) chunks = text_splitter . split_documents ( documents ) # 4. Create vector store vectorstore = Chroma . from_documents ( documents = chunks , embedding = embeddings , persist_directory = "./chroma_db" ) # 5. Create retrieval chain qa_chain = RetrievalQA . from_chain_type ( llm = llm , chain_type = "stuff" , retriever = vectorstore . as_retriever ( search_kwargs = { "k" : 3 }), return_source_documents = True ) # 6. Query your documents query = "What are the key points in the document?" result = qa_chain . invoke ({ "query" : query }) print ( "Answer:" , result [ "result" ]) print ( " \n Sources:" ) for doc in result [ "source_documents" ]: print ( f "- { doc . page_content [: 100 ] } ..." ) Agents and Tools ¶ Build LangChain agents powered by Bedrock models. Python - Agent with Tools from langchain_openai import ChatOpenAI from langchain.agents import create_openai_functions_agent , AgentExecutor from langchain.tools import Tool from langchain import hub # Configure LLM llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = "your_stdapi_key_here" , openai_api_base = "https://YOUR_SERVER_URL/v1" , temperature = 0 ) # Define custom tools def search_documentation ( query : str ) -> str : """Search internal documentation.""" # Your search logic here return f "Search results for: { query } " def calculate ( expression : str ) -> str : """Perform calculations.""" try : return str ( eval ( expression )) except : return "Invalid expression" tools = [ Tool ( name = "SearchDocs" , func = search_documentation , description = "Search internal documentation for information" ), Tool ( name = "Calculator" , func = calculate , description = "Perform mathematical calculations" ) ] # Get the prompt template prompt = hub . pull ( "hwchase17/openai-functions-agent" ) # Create agent agent = create_openai_functions_agent ( llm , tools , prompt ) agent_executor = AgentExecutor ( agent = agent , tools = tools , verbose = True ) # Run the agent result = agent_executor . invoke ({ "input" : "Search our docs for API authentication and calculate 15 * 23" }) print ( result [ "output" ]) 🦙 LlamaIndex Python Integration ¶ Installation ¶ Install LlamaIndex # Install LlamaIndex with OpenAI support pip install llama-index llama-index-llms-openai llama-index-embeddings-openai Basic Setup ¶ Configure LlamaIndex to use stdapi.ai. Python - LlamaIndex Setup from llama_index.llms.openai import OpenAI from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.core import Settings # Configure LLM llm = OpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , api_key = "your_stdapi_key_here" , api_base = "https://YOUR_SERVER_URL/v1" , temperature = 0.7 ) # Configure embeddings embed_model = OpenAIEmbedding ( model = "amazon.titan-embed-text-v2:0" , api_key = "your_stdapi_key_here" , api_base = "https://YOUR_SERVER_URL/v1" ) # Set global defaults Settings . llm = llm Settings . embed_model = embed_model # Use the LLM response = llm . complete ( "Explain the benefits of vector databases" ) print ( response ) Document Indexing and Query ¶ Build a searchable knowledge base with LlamaIndex. Python - LlamaIndex RAG from llama_index.llms.openai import OpenAI from llama_index.embeddings.openai import OpenAIEmbedding from llama_index.core import ( VectorStoreIndex , SimpleDirectoryReader , Settings ) # Configure models Settings . llm = OpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , api_key = "your_stdapi_key_here" , api_base = "https://YOUR_SERVER_URL/v1" ) Settings . embed_model = OpenAIEmbedding ( model = "amazon.titan-embed-text-v2:0" , api_key = "your_stdapi_key_here" , api_base = "https://YOUR_SERVER_URL/v1" ) # Load documents documents = SimpleDirectoryReader ( "./data" ) . load_data () # Create index index = VectorStoreIndex . from_documents ( documents ) # Query the index query_engine = index . as_query_engine ( similarity_top_k = 3 ) response = query_engine . query ( "What are the main topics in these documents?" ) print ( response ) 🟨 LangChain JavaScript/TypeScript Integration ¶ Installation ¶ Install LangChain.js # Using npm npm install langchain @langchain/openai # Using yarn yarn add langchain @langchain/openai Basic Chat Model Setup ¶ TypeScript - Basic Chat import { ChatOpenAI } from "@langchain/openai" ; // Configure chat model to use stdapi.ai const llm = new ChatOpenAI ({ modelName : "anthropic.claude-sonnet-4-5-20250929-v1:0" , openAIApiKey : "your_stdapi_key_here" , configuration : { baseURL : "https://YOUR_SERVER_URL/v1" , }, temperature : 0.7 , }); // Use it const response = await llm . invoke ( "Explain machine learning in simple terms" ); console . log ( response . content ); RAG with LangChain.js ¶ TypeScript - RAG Application import { ChatOpenAI , OpenAIEmbeddings } from "@langchain/openai" ; import { MemoryVectorStore } from "langchain/vectorstores/memory" ; import { RetrievalQAChain } from "langchain/chains" ; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter" ; import { Document } from "langchain/document" ; // Configure models const llm = new ChatOpenAI ({ modelName : "anthropic.claude-sonnet-4-5-20250929-v1:0" , openAIApiKey : "your_stdapi_key_here" , configuration : { baseURL : "https://YOUR_SERVER_URL/v1" , }, temperature : 0 , }); const embeddings = new OpenAIEmbeddings ({ modelName : "amazon.titan-embed-text-v2:0" , openAIApiKey : "your_stdapi_key_here" , configuration : { baseURL : "https://YOUR_SERVER_URL/v1" , }, }); // Load and split documents const documents = [ new Document ({ pageContent : "Your document text here..." }), new Document ({ pageContent : "Another document..." }), ]; const textSplitter = new RecursiveCharacterTextSplitter ({ chunkSize : 1000 , chunkOverlap : 200 , }); const chunks = await textSplitter . splitDocuments ( documents ); // Create vector store const vectorStore = await MemoryVectorStore . fromDocuments ( chunks , embeddings ); // Create retrieval chain const chain = RetrievalQAChain . fromLLM ( llm , vectorStore . asRetriever ( 3 ) ); // Query const result = await chain . call ({ query : "What are the key points in the document?" , }); console . log ( result . text ); 💡 Common Patterns and Best Practices ¶ Environment Variables ¶ Store credentials securely using environment variables. Python - Environment Variables import os from langchain_openai import ChatOpenAI llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = os . getenv ( "STDAPI_KEY" ), openai_api_base = os . getenv ( "STDAPI_BASE_URL" ), temperature = 0.7 ) TypeScript - Environment Variables import { ChatOpenAI } from "@langchain/openai" ; const llm = new ChatOpenAI ({ modelName : "anthropic.claude-sonnet-4-5-20250929-v1:0" , openAIApiKey : process.env.STDAPI_KEY , configuration : { baseURL : process.env.STDAPI_BASE_URL , }, temperature : 0.7 , }); Streaming Responses ¶ Enable streaming for better user experience in interactive applications. Python - Streaming from langchain_openai import ChatOpenAI from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = "your_stdapi_key_here" , openai_api_base = "https://YOUR_SERVER_URL/v1" , streaming = True , callbacks = [ StreamingStdOutCallbackHandler ()] ) # Response will stream to stdout as it's generated llm . invoke ( "Write a long story about artificial intelligence" ) Retry Logic and Error Handling ¶ Implement robust error handling for production applications. Python - Error Handling from langchain_openai import ChatOpenAI from langchain.globals import set_llm_cache from langchain.cache import InMemoryCache import time # Enable caching to reduce redundant calls set_llm_cache ( InMemoryCache ()) llm = ChatOpenAI ( model = "anthropic.claude-sonnet-4-5-20250929-v1:0" , openai_api_key = "your_stdapi_key_here" , openai_api_base = "https://YOUR_SERVER_URL/v1" , max_retries = 3 , request_timeout = 60 ) def query_with_retry ( prompt : str , max_attempts : int = 3 ): for attempt in range ( max_attempts ): try : response = llm . invoke ( prompt ) return response . content except Exception as e : if attempt < max_attempts - 1 : wait_time = 2 ** attempt # Exponential backoff print ( f "Attempt { attempt + 1 } failed: { e } . Retrying in { wait_time } s..." ) time . sleep ( wait_time ) else : raise result = query_with_retry ( "Your prompt here" ) 📊 Model Recommendations ¶ Choose the right model for your application needs. These are examples —all Bedrock models are available. Use Case Example Model Why Complex RAG anthropic.claude-sonnet-4-5-20250929-v1:0 Superior reasoning and context understanding Fast Queries amazon.nova-micro-v1:0 Quick responses, cost-effective Long Documents amazon.nova-pro-v1:0 Large context window (300K tokens) Balanced amazon.nova-lite-v1:0 Good performance at reasonable cost Code Generation anthropic.claude-sonnet-4-5-20250929-v1:0 Excellent coding capabilities Embeddings amazon.titan-embed-text-v2:0 High-dimensional (8192), optimized for RAG 🔧 Migration from OpenAI ¶ Migrating existing LangChain/LlamaIndex applications is straightforward. Migration Steps 1. Update Configuration: - Change openai_api_base to your stdapi.ai URL - Change openai_api_key to your stdapi.ai key - Change model names to Bedrock model IDs 2. Test Thoroughly: - Start with non-critical workflows - Compare outputs between OpenAI and Bedrock models - Monitor performance and costs 3. Gradual Rollout: - Deploy to staging/dev environments first - Run A/B tests if possible - Gather team feedback 4. Monitor and Optimize: - Track token usage and costs - Adjust model selection based on performance - Fine-tune prompts for Bedrock models 🚀 Next Steps & Resources ¶ Getting Started ¶ Try Examples: Run the code examples above with your stdapi.ai credentials Build a Prototype: Start with a simple RAG application Experiment with Models: Test different Bedrock models for your use case Scale Up: Move to production with proper error handling and monitoring Optimize: Fine-tune model selection and parameters for cost/performance Learn More ¶ Additional Resources LangChain Documentation — Official LangChain guides LlamaIndex Documentation — Official LlamaIndex guides API Overview — Complete list of available Bedrock models Chat Completions API — Detailed API documentation Configuration Guide — Advanced stdapi.ai configuration Community & Support ¶ Need Help? 💬 Join the LangChain Discord for framework questions 💬 Join the LlamaIndex Discord for framework questions 📖 Review Amazon Bedrock documentation for model-specific details 🐛 Report issues on the GitHub repository ⚠️ Important Considerations ¶ Model Availability Regional Differences: Not all Amazon Bedrock models are available in every AWS region. Verify model availability before deploying production applications. Check availability: See the API Overview for supported models by region. API Compatibility OpenAI Compatibility: stdapi.ai implements the OpenAI API specification. Most features work seamlessly, but some advanced OpenAI-specific features may have differences. Function Calling: Function calling support varies by model—test thoroughly if your application relies on it. Cost Optimization Cache Frequently Used Results: Use LangChain's caching to reduce API calls Right-Size Context: Only include necessary context in prompts to reduce token usage Choose Efficient Models: Use Nova Micro/Lite for simple tasks, premium models for complex reasoning Batch Processing: Process multiple items in batches when possible Monitor Token Usage: Track consumption and set up alerts for unexpected spikes Back to top Previous LibreChat integration Next Note-taking apps (Obsidian & Notion) JGoutin-dev SARL - 994495422 R.C.S. Aix-en-Provence, France
2026-01-13T09:30:24
https://github.com/jimweirich
jimweirich (Jim Weirich) · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection Stop leaks before they start EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events & webinars Ebooks & reports Business insights GitHub Skills SUPPORT & SERVICES Documentation Customer support Community forum Trust center Partners Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} jimweirich Follow Overview Repositories 65 Projects 0 Packages 0 Stars 63 More Overview Repositories Projects Packages Stars jimweirich Follow Jim Weirich jimweirich Follow 1.8k followers · 0 following Neo Cincinnati http://onestepback.org Achievements x3 Achievements x3 Organizations Block or Report Block or report jimweirich --> Block user Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users . You must be logged in to block users. Add an optional note Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you. Block user Report abuse Contact GitHub support about this user’s behavior. Learn more about reporting abuse . Report abuse Overview Repositories 65 Projects 0 Packages 0 Stars 63 More Overview Repositories Projects Packages Stars Popular repositories Loading rake rake Public Forked from ruby/rake A make-like build utility for Ruby. 1.1k 10 rspec-given rspec-given Public Given/When/Then keywords for RSpec Specifications Ruby 651 59 builder builder Public Provide a simple way to create XML markup and data structures. Ruby 363 106 wyriki wyriki Public Experimental Rails application to explore decoupling app logic from Rails. CSS 272 38 gilded_rose_kata gilded_rose_kata Public The Gilded Rose Code Cata Ruby 207 283 re re Public Regular Expression Construction Ruby 182 18 Something went wrong, please refresh the page to try again. If the problem persists, check the GitHub status page or contact support . Uh oh! There was an error while loading. Please reload this page . Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:24
https://l.facebook.com/l.php?u=https%3A%2F%2Fwww.instagram.com%2F&h=AT1InsrcAfpj6juIO0iTFvCHFgE_7RLhojcL5-F7qdX9QM-dciYOid2qu592TS0UHswvyPJOWIO_QizxzgIJaqbfvfwAvD7XSGDD3Bh8LQV7RYKx8emo02yj7u5XtTTL4qNrQ6L0WtkddsVH
Facebook Facebook 이메일 또는 휴대폰 비밀번호 계정을 잊으셨나요? 새 계정 만들기 일시적으로 차단됨 일시적으로 차단됨 회원님의 이 기능 사용 속도가 너무 빠른 것 같습니다. 이 기능 사용에서 일시적으로 차단되었습니다. Back 한국어 English (US) Tiếng Việt Bahasa Indonesia ภาษาไทย Español 中文(简体) 日本語 Português (Brasil) Français (France) Deutsch 가입하기 로그인 Messenger Facebook Lite 동영상 Meta Pay Meta 스토어 Meta Quest Ray-Ban Meta Meta AI Meta AI 콘텐츠 더 보기 Instagram Threads 투표 정보 센터 개인정보처리방침 개인정보 보호 센터 정보 광고 만들기 페이지 만들기 개발자 채용 정보 쿠키 AdChoices 이용 약관 고객 센터 연락처 업로드 및 비사용자 설정 활동 로그 Meta © 2026
2026-01-13T09:30:24
http://heisenbug.blogspot.com/2010/11/applicative-structures-and-thrists.html#main
don't count on finding me: Applicative Structures and Thrists skip to main | skip to sidebar don't count on finding me Saturday, November 27, 2010 Applicative Structures and Thrists I've been toying with the idea of furnishing the the applicative framework into thrist-like clothing , with early attempts here . Last night I might have gotten it, finally... Here is the idea. Since function application is left-associative, but thrists are right associative, I'll reverse the application's direction to right-to-left, i.e. f a b c will become c b a f . This uglyness is another reason to finally whip up a RevThrist , which would be SNOC-like and left-associative. We need following ingredients: Fun - functions perform the reduction to a new object, Arg - arguments successively saturate the applicable structure to the right, Par - partial application (or parent) initiates the reduction. I'll explain these elements next, but first rewrite the above expression a bit to get a parentesized form (c(b(a f))) , and now with roles marked up in thrist syntax: Cons (Arg c) $ Cons (Arg b) $ Cons (Arg a) $ Cons (Fun f) Nil Looks almost reasonable. Time to define the ingredients mentioned above. Remember, that it must be a two-parameter data type and that the types must match up between Arg c and Arg b , etc., and finally between Arg a and Fun f . This is a pretty hefty requirement! We can attempt passing the effective application type between the ingredients, defining the data structure as data Appli :: * → * → * where   Fun :: (a → b) → Appli (a → b) c   Arg :: a → Appli b (a → b) This means functions pass their own type to the left (and ignoring what comes from the right), while arguments expect a saturable effective type from the right, store an appropriate value and propagate the remaining type to the left. This should work now: Cons (Arg 'a') $ Cons (Fun ord) Nil , with the type being Thrist Appli Int c . As you can see, no function type gets passed to the left, so you cannot prepend any more arguments. But this all appears useless since we cannot nest things. The Par ingredient will take care of this: Par :: Thrist Appli a c → Appli b (a → b) Par has a double role, it acts just like an argument, but holding a thrist inside, and thus groups a sub-application. The c type variable occurring in Par and Fun troubled me a lot, because it allows building up illegal thrists. Consider Cons (Fun f) $ Cons (Fun f) Nil . This gibberish cannot be assigned any reasonable semantics! Finally it occurred to me to use a phantom type for filling in this breach: data Peg Since Peg is uninhabited, no function signature can include it (unless it is a divergent one). It also ensures that the leftmost ingredient in a thrist is a function, how practial for Par ! Anyway, our Appli is done now: data Appli :: * → * → * where   Fun :: (a → b) → Appli (a → b) Peg   Arg :: a → Appli b (a → b)   Par :: Thrist Appli a Peg → Appli b (a → b) So what brave soul will try this out? Because I must confess, up to this point I've been too lazy to fire up GHC! You might be inclined to say, why this whole circus? An awkward notation for something as simple as function application? Any Haskell implementation can do this with a beautiful syntax! Yes, we can build up applications but can't even compute them. This is a toy at the moment. But try to pull apart an application in Haskell! You can't! Here you can add an evaluator ( foldlThrist ?) and also instrument, trace, debug your evaluation process. Also, there is a reason I say 'Applicative Structures' in the title. Here is a generalization of Appli that is parametrized: data Appli :: ( * → * → * ) → * → * → * where   Fun :: (a ~> b) → Appli ( ~> ) (a ~> b) Peg   Arg :: a → Appli ( ~> ) b (a ~> b)   Par :: Thrist (Appli ( ~> )) a Peg → Appli ( ~> ) b (a ~> b) You are free now to create your own function and value space with attached typing rules and still be able to use Thrist (Appli MySpace) ... The possibilities are endless, e.g. encrypted execution on remote hosts or abstract interpretation, you say it. Have Fun ! Posted by heisenbug at 6:37 AM Labels: applicative , haskell , thrist No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) Blog Archive ►  2022 (1) ►  February (1) ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ▼  2010 (19) ►  December (5) ▼  November (6) More on Existentials Applicative Structures and Thrists Type Synonyms Generalized Patterns and Existentials Hats off Cooperation ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
https://github.com/kruczjak
kruczjak (Jakub Kruczek) · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection Stop leaks before they start EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events & webinars Ebooks & reports Business insights GitHub Skills SUPPORT & SERVICES Documentation Customer support Community forum Trust center Partners Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} kruczjak Follow Overview Repositories 96 Projects 0 Packages 0 Stars 441 More Overview Repositories Projects Packages Stars kruczjak Follow Jakub Kruczek kruczjak Follow 14 followers · 6 following @Placewise Poland Achievements x3 x3 Achievements x3 x3 Organizations Block or Report Block or report kruczjak --> Block user Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users . You must be logged in to block users. Add an optional note Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you. Block user Report abuse Contact GitHub support about this user’s behavior. Learn more about reporting abuse . Report abuse Overview Repositories 96 Projects 0 Packages 0 Stars 441 More Overview Repositories Projects Packages Stars Popular repositories Loading kubernetes-kafka-tests kubernetes-kafka-tests Public Project Go 1 GraphicChat GraphicChat Public Oddane Java JavaPaint JavaPaint Public Oddane Java GraphicalCalculator GraphicalCalculator Public Oddane Java Library Library Public Oddane Java PriorityThreads PriorityThreads Public Oddane Java Something went wrong, please refresh the page to try again. If the problem persists, check the GitHub status page or contact support . Uh oh! There was an error while loading. Please reload this page . Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:24
http://hackage.haskell.org/package/base-4.6.0.1/docs/Prelude.html#v:const
Prelude Source Contents Index base-4.6.0.1: Basic libraries Portability portable Stability stable Maintainer libraries@haskell.org Safe Haskell Trustworthy Prelude Contents Standard types, classes and related functions Basic data types Tuples Basic type classes Numbers Numeric types Numeric type classes Numeric functions Monads and functors Miscellaneous functions List operations Reducing lists (folds) Special folds Building lists Scans Infinite lists Sublists Searching lists Zipping and unzipping lists Functions on strings Converting to and from String Converting to String Converting from String Basic Input and output Simple I/O operations Output functions Input functions Files Exception handling in the I/O monad Description The Prelude: a standard module imported by default into all Haskell modules. For more documentation, see the Haskell 98 Report http://www.haskell.org/onlinereport/ . Synopsis data Bool = False | True (&&) :: Bool -> Bool -> Bool (||) :: Bool -> Bool -> Bool not :: Bool -> Bool otherwise :: Bool data Maybe a = Nothing | Just a maybe :: b -> (a -> b) -> Maybe a -> b data Either a b = Left a | Right b either :: (a -> c) -> (b -> c) -> Either a b -> c data Ordering = LT | EQ | GT data Char type String = [ Char ] fst :: (a, b) -> a snd :: (a, b) -> b curry :: ((a, b) -> c) -> a -> b -> c uncurry :: (a -> b -> c) -> (a, b) -> c class Eq a where (==) :: a -> a -> Bool (/=) :: a -> a -> Bool class Eq a => Ord a where compare :: a -> a -> Ordering (<) :: a -> a -> Bool (>=) :: a -> a -> Bool (>) :: a -> a -> Bool (<=) :: a -> a -> Bool max :: a -> a -> a min :: a -> a -> a class Enum a where succ :: a -> a pred :: a -> a toEnum :: Int -> a fromEnum :: a -> Int enumFrom :: a -> [a] enumFromThen :: a -> a -> [a] enumFromTo :: a -> a -> [a] enumFromThenTo :: a -> a -> a -> [a] class Bounded a where minBound , maxBound :: a data Int data Integer data Float data Double type Rational = Ratio Integer class Num a where (+) , (*) , (-) :: a -> a -> a negate :: a -> a abs :: a -> a signum :: a -> a fromInteger :: Integer -> a class ( Num a, Ord a) => Real a where toRational :: a -> Rational class ( Real a, Enum a) => Integral a where quot :: a -> a -> a rem :: a -> a -> a div :: a -> a -> a mod :: a -> a -> a quotRem :: a -> a -> (a, a) divMod :: a -> a -> (a, a) toInteger :: a -> Integer class Num a => Fractional a where (/) :: a -> a -> a recip :: a -> a fromRational :: Rational -> a class Fractional a => Floating a where pi :: a exp , sqrt , log :: a -> a (**) , logBase :: a -> a -> a sin , tan , cos :: a -> a asin , atan , acos :: a -> a sinh , tanh , cosh :: a -> a asinh , atanh , acosh :: a -> a class ( Real a, Fractional a) => RealFrac a where properFraction :: Integral b => a -> (b, a) truncate :: Integral b => a -> b round :: Integral b => a -> b ceiling :: Integral b => a -> b floor :: Integral b => a -> b class ( RealFrac a, Floating a) => RealFloat a where floatRadix :: a -> Integer floatDigits :: a -> Int floatRange :: a -> ( Int , Int ) decodeFloat :: a -> ( Integer , Int ) encodeFloat :: Integer -> Int -> a exponent :: a -> Int significand :: a -> a scaleFloat :: Int -> a -> a isNaN :: a -> Bool isInfinite :: a -> Bool isDenormalized :: a -> Bool isNegativeZero :: a -> Bool isIEEE :: a -> Bool atan2 :: a -> a -> a subtract :: Num a => a -> a -> a even :: Integral a => a -> Bool odd :: Integral a => a -> Bool gcd :: Integral a => a -> a -> a lcm :: Integral a => a -> a -> a (^) :: ( Num a, Integral b) => a -> b -> a (^^) :: ( Fractional a, Integral b) => a -> b -> a fromIntegral :: ( Integral a, Num b) => a -> b realToFrac :: ( Real a, Fractional b) => a -> b class Monad m where (>>=) :: forall a b. m a -> (a -> m b) -> m b (>>) :: forall a b. m a -> m b -> m b return :: a -> m a fail :: String -> m a class Functor f where fmap :: (a -> b) -> f a -> f b mapM :: Monad m => (a -> m b) -> [a] -> m [b] mapM_ :: Monad m => (a -> m b) -> [a] -> m () sequence :: Monad m => [m a] -> m [a] sequence_ :: Monad m => [m a] -> m () (=<<) :: Monad m => (a -> m b) -> m a -> m b id :: a -> a const :: a -> b -> a (.) :: (b -> c) -> (a -> b) -> a -> c flip :: (a -> b -> c) -> b -> a -> c ($) :: (a -> b) -> a -> b until :: (a -> Bool ) -> (a -> a) -> a -> a asTypeOf :: a -> a -> a error :: [ Char ] -> a undefined :: a seq :: a -> b -> b ($!) :: (a -> b) -> a -> b map :: (a -> b) -> [a] -> [b] (++) :: [a] -> [a] -> [a] filter :: (a -> Bool ) -> [a] -> [a] head :: [a] -> a last :: [a] -> a tail :: [a] -> [a] init :: [a] -> [a] null :: [a] -> Bool length :: [a] -> Int (!!) :: [a] -> Int -> a reverse :: [a] -> [a] foldl :: (a -> b -> a) -> a -> [b] -> a foldl1 :: (a -> a -> a) -> [a] -> a foldr :: (a -> b -> b) -> b -> [a] -> b foldr1 :: (a -> a -> a) -> [a] -> a and :: [ Bool ] -> Bool or :: [ Bool ] -> Bool any :: (a -> Bool ) -> [a] -> Bool all :: (a -> Bool ) -> [a] -> Bool sum :: Num a => [a] -> a product :: Num a => [a] -> a concat :: [[a]] -> [a] concatMap :: (a -> [b]) -> [a] -> [b] maximum :: Ord a => [a] -> a minimum :: Ord a => [a] -> a scanl :: (a -> b -> a) -> a -> [b] -> [a] scanl1 :: (a -> a -> a) -> [a] -> [a] scanr :: (a -> b -> b) -> b -> [a] -> [b] scanr1 :: (a -> a -> a) -> [a] -> [a] iterate :: (a -> a) -> a -> [a] repeat :: a -> [a] replicate :: Int -> a -> [a] cycle :: [a] -> [a] take :: Int -> [a] -> [a] drop :: Int -> [a] -> [a] splitAt :: Int -> [a] -> ([a], [a]) takeWhile :: (a -> Bool ) -> [a] -> [a] dropWhile :: (a -> Bool ) -> [a] -> [a] span :: (a -> Bool ) -> [a] -> ([a], [a]) break :: (a -> Bool ) -> [a] -> ([a], [a]) elem :: Eq a => a -> [a] -> Bool notElem :: Eq a => a -> [a] -> Bool lookup :: Eq a => a -> [(a, b)] -> Maybe b zip :: [a] -> [b] -> [(a, b)] zip3 :: [a] -> [b] -> [c] -> [(a, b, c)] zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] unzip :: [(a, b)] -> ([a], [b]) unzip3 :: [(a, b, c)] -> ([a], [b], [c]) lines :: String -> [ String ] words :: String -> [ String ] unlines :: [ String ] -> String unwords :: [ String ] -> String type ShowS = String -> String class Show a where showsPrec :: Int -> a -> ShowS show :: a -> String showList :: [a] -> ShowS shows :: Show a => a -> ShowS showChar :: Char -> ShowS showString :: String -> ShowS showParen :: Bool -> ShowS -> ShowS type ReadS a = String -> [(a, String )] class Read a where readsPrec :: Int -> ReadS a readList :: ReadS [a] reads :: Read a => ReadS a readParen :: Bool -> ReadS a -> ReadS a read :: Read a => String -> a lex :: ReadS String data IO a putChar :: Char -> IO () putStr :: String -> IO () putStrLn :: String -> IO () print :: Show a => a -> IO () getChar :: IO Char getLine :: IO String getContents :: IO String interact :: ( String -> String ) -> IO () type FilePath = String readFile :: FilePath -> IO String writeFile :: FilePath -> String -> IO () appendFile :: FilePath -> String -> IO () readIO :: Read a => String -> IO a readLn :: Read a => IO a type IOError = IOException ioError :: IOError -> IO a userError :: String -> IOError Standard types, classes and related functions Basic data types data Bool Source Constructors False   True   Instances Bounded Bool   Enum Bool   Eq Bool   Data Bool   Ord Bool   Read Bool   Show Bool   Ix Bool   Typeable Bool   Generic Bool   Storable Bool   (&&) :: Bool -> Bool -> Bool Source Boolean "and" (||) :: Bool -> Bool -> Bool Source Boolean "or" not :: Bool -> Bool Source Boolean "not" otherwise :: Bool Source otherwise is defined as the value True . It helps to make guards more readable. eg. f x | x < 0 = ... | otherwise = ... data Maybe a Source The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as Just a ), or it is empty (represented as Nothing ). Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error . The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by Nothing . A richer error monad can be built using the Either type. Constructors Nothing   Just a   Instances Monad Maybe   Functor Maybe   Typeable1 Maybe   MonadFix Maybe   MonadPlus Maybe   Applicative Maybe   Foldable Maybe   Traversable Maybe   Generic1 Maybe   Alternative Maybe   Eq a => Eq ( Maybe a)   Data a => Data ( Maybe a)   Ord a => Ord ( Maybe a)   Read a => Read ( Maybe a)   Show a => Show ( Maybe a)   Generic ( Maybe a)   Monoid a => Monoid ( Maybe a) Lift a semigroup into Maybe forming a Monoid according to http://en.wikipedia.org/wiki/Monoid : "Any semigroup S may be turned into a monoid simply by adjoining an element e not in S and defining e*e = e and e*s = s = s*e for all s ∈ S ." Since there is no "Semigroup" typeclass providing just mappend , we use Monoid instead. maybe :: b -> (a -> b) -> Maybe a -> b Source The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Nothing , the function returns the default value. Otherwise, it applies the function to the value inside the Just and returns the result. data Either a b Source The Either type represents values with two possibilities: a value of type Either a b is either Left a or Right b . The Either type is sometimes used to represent a value which is either correct or an error; by convention, the Left constructor is used to hold an error value and the Right constructor is used to hold a correct value (mnemonic: "right" also means "correct"). Constructors Left a   Right b   Instances Typeable2 Either   Monad ( Either e)   Functor ( Either a)   MonadFix ( Either e)   Applicative ( Either e)   Generic1 ( Either a)   ( Eq a, Eq b) => Eq ( Either a b)   ( Data a, Data b) => Data ( Either a b)   ( Ord a, Ord b) => Ord ( Either a b)   ( Read a, Read b) => Read ( Either a b)   ( Show a, Show b) => Show ( Either a b)   Generic ( Either a b)   either :: (a -> c) -> (b -> c) -> Either a b -> c Source Case analysis for the Either type. If the value is Left a , apply the first function to a ; if it is Right b , apply the second function to b . data Ordering Source Constructors LT   EQ   GT   Instances Bounded Ordering   Enum Ordering   Eq Ordering   Data Ordering   Ord Ordering   Read Ordering   Show Ordering   Ix Ordering   Typeable Ordering   Generic Ordering   Monoid Ordering   data Char Source The character type Char is an enumeration whose values represent Unicode (or equivalently ISO/IEC 10646) characters (see http://www.unicode.org/ for details). This set extends the ISO 8859-1 (Latin-1) character set (the first 256 characters), which is itself an extension of the ASCII character set (the first 128 characters). A character literal in Haskell has type Char . To convert a Char to or from the corresponding Int value defined by Unicode, use toEnum and fromEnum from the Enum class respectively (or equivalently ord and chr ). Instances Bounded Char   Enum Char   Eq Char   Data Char   Ord Char   Read Char   Show Char   Ix Char   Typeable Char   Generic Char   Storable Char   IsChar Char   PrintfArg Char   SingE Symbol ( Kind Symbol ) String   IsString [ Char ]   type String = [ Char ] Source A String is a list of characters. String constants in Haskell are values of type String . Tuples fst :: (a, b) -> a Source Extract the first component of a pair. snd :: (a, b) -> b Source Extract the second component of a pair. curry :: ((a, b) -> c) -> a -> b -> c Source curry converts an uncurried function to a curried function. uncurry :: (a -> b -> c) -> (a, b) -> c Source uncurry converts a curried function to a function on pairs. Basic type classes class Eq a where Source The Eq class defines equality ( == ) and inequality ( /= ). All the basic datatypes exported by the Prelude are instances of Eq , and Eq may be derived for any datatype whose constituents are also instances of Eq . Minimal complete definition: either == or /= . Methods (==) :: a -> a -> Bool Source (/=) :: a -> a -> Bool Source Instances Eq Bool   Eq Char   Eq Double   Eq Float   Eq Int   Eq Int8   Eq Int16   Eq Int32   Eq Int64   Eq Integer   Eq Ordering   Eq Word   Eq Word8   Eq Word16   Eq Word32   Eq Word64   Eq ()   Eq TyCon   Eq TypeRep   Eq ArithException   Eq IOException   Eq MaskingState   Eq Lexeme   Eq Fingerprint   Eq IOMode   Eq SeekMode   Eq IODeviceType   Eq CUIntMax   Eq CIntMax   Eq CUIntPtr   Eq CIntPtr   Eq CSUSeconds   Eq CUSeconds   Eq CTime   Eq CClock   Eq CSigAtomic   Eq CWchar   Eq CSize   Eq CPtrdiff   Eq CDouble   Eq CFloat   Eq CULLong   Eq CLLong   Eq CULong   Eq CLong   Eq CUInt   Eq CInt   Eq CUShort   Eq CShort   Eq CUChar   Eq CSChar   Eq CChar   Eq GeneralCategory   Eq TypeRepKey   Eq Associativity   Eq Fixity   Eq Arity   Eq IntPtr   Eq WordPtr   Eq Any   Eq All   Eq BufferState   Eq CodingProgress   Eq NewlineMode   Eq Newline   Eq BufferMode   Eq Handle   Eq IOErrorType   Eq ExitCode   Eq ArrayException   Eq AsyncException   Eq Errno   Eq ThreadStatus   Eq BlockReason   Eq ThreadId   Eq Fd   Eq CRLim   Eq CTcflag   Eq CSpeed   Eq CCc   Eq CUid   Eq CNlink   Eq CGid   Eq CSsize   Eq CPid   Eq COff   Eq CMode   Eq CIno   Eq CDev   Eq Event   Eq TimeoutKey   Eq FdKey   Eq HandlePosn   Eq Fixity   Eq ConstrRep   Eq DataRep   Eq Constr Equality of constructors Eq SpecConstrAnnotation   Eq Unique   Eq QSem   Eq QSemN   Eq Version   Eq a => Eq [a]   Eq a => Eq ( Ratio a)   Eq ( StablePtr a)   Eq ( Ptr a)   Eq ( FunPtr a)   Eq a => Eq ( Maybe a)   Eq ( MVar a)   Eq a => Eq ( Down a)   Eq ( IORef a)   Eq ( ForeignPtr a)   Eq a => Eq ( Last a)   Eq a => Eq ( First a)   Eq a => Eq ( Product a)   Eq a => Eq ( Sum a)   Eq a => Eq ( Dual a)   Eq ( TVar a)   Eq ( Chan a)   Eq ( SampleVar a)   Eq a => Eq ( Complex a)   Eq ( Fixed a)   Eq ( StableName a)   ( Eq a, Eq b) => Eq ( Either a b)   ( Eq a, Eq b) => Eq (a, b)   Eq ( STRef s a)   ( Eq a, Eq b, Eq c) => Eq (a, b, c)   ( Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d)   ( Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n)   ( Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)   class Eq a => Ord a where Source The Ord class is used for totally ordered datatypes. Instances of Ord can be derived for any user-defined datatype whose constituent types are in Ord . The declared order of the constructors in the data declaration determines the ordering in derived Ord instances. The Ordering datatype allows a single comparison to determine the precise ordering of two objects. Minimal complete definition: either compare or <= . Using compare can be more efficient for complex types. Methods compare :: a -> a -> Ordering Source (<) :: a -> a -> Bool Source (>=) :: a -> a -> Bool Source (>) :: a -> a -> Bool Source (<=) :: a -> a -> Bool Source max :: a -> a -> a Source min :: a -> a -> a Source Instances Ord Bool   Ord Char   Ord Double   Ord Float   Ord Int   Ord Int8   Ord Int16   Ord Int32   Ord Int64   Ord Integer   Ord Ordering   Ord Word   Ord Word8   Ord Word16   Ord Word32   Ord Word64   Ord ()   Ord TyCon   Ord TypeRep   Ord ArithException   Ord Fingerprint   Ord IOMode   Ord SeekMode   Ord CUIntMax   Ord CIntMax   Ord CUIntPtr   Ord CIntPtr   Ord CSUSeconds   Ord CUSeconds   Ord CTime   Ord CClock   Ord CSigAtomic   Ord CWchar   Ord CSize   Ord CPtrdiff   Ord CDouble   Ord CFloat   Ord CULLong   Ord CLLong   Ord CULong   Ord CLong   Ord CUInt   Ord CInt   Ord CUShort   Ord CShort   Ord CUChar   Ord CSChar   Ord CChar   Ord GeneralCategory   Ord TypeRepKey   Ord Associativity   Ord Fixity   Ord Arity   Ord IntPtr   Ord WordPtr   Ord Any   Ord All   Ord NewlineMode   Ord Newline   Ord BufferMode   Ord ExitCode   Ord ArrayException   Ord AsyncException   Ord ThreadStatus   Ord BlockReason   Ord ThreadId   Ord Fd   Ord CRLim   Ord CTcflag   Ord CSpeed   Ord CCc   Ord CUid   Ord CNlink   Ord CGid   Ord CSsize   Ord CPid   Ord COff   Ord CMode   Ord CIno   Ord CDev   Ord Unique   Ord Version   Ord a => Ord [a]   Integral a => Ord ( Ratio a)   Ord ( Ptr a)   Ord ( FunPtr a)   Ord a => Ord ( Maybe a)   Ord a => Ord ( Down a)   Ord ( ForeignPtr a)   Ord a => Ord ( Last a)   Ord a => Ord ( First a)   Ord a => Ord ( Product a)   Ord a => Ord ( Sum a)   Ord a => Ord ( Dual a)   Ord ( Fixed a)   ( Ord a, Ord b) => Ord ( Either a b)   ( Ord a, Ord b) => Ord (a, b)   ( Ord a, Ord b, Ord c) => Ord (a, b, c)   ( Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d)   ( Ord a, Ord b, Ord c, Ord d, Ord e) => Ord (a, b, c, d, e)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f) => Ord (a, b, c, d, e, f)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g) => Ord (a, b, c, d, e, f, g)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h) => Ord (a, b, c, d, e, f, g, h)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i) => Ord (a, b, c, d, e, f, g, h, i)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j) => Ord (a, b, c, d, e, f, g, h, i, j)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k) => Ord (a, b, c, d, e, f, g, h, i, j, k)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l) => Ord (a, b, c, d, e, f, g, h, i, j, k, l)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n)   ( Ord a, Ord b, Ord c, Ord d, Ord e, Ord f, Ord g, Ord h, Ord i, Ord j, Ord k, Ord l, Ord m, Ord n, Ord o) => Ord (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)   class Enum a where Source Class Enum defines operations on sequentially ordered types. The enumFrom ... methods are used in Haskell's translation of arithmetic sequences. Instances of Enum may be derived for any enumeration type (types whose constructors have no fields). The nullary constructors are assumed to be numbered left-to-right by fromEnum from 0 through n-1 . See Chapter 10 of the Haskell Report for more details. For any type that is an instance of class Bounded as well as Enum , the following should hold: The calls succ maxBound and pred minBound should result in a runtime error. fromEnum and toEnum should give a runtime error if the result value is not representable in the result type. For example, toEnum 7 :: Bool is an error. enumFrom and enumFromThen should be defined with an implicit bound, thus: enumFrom x = enumFromTo x maxBound enumFromThen x y = enumFromThenTo x y bound where bound | fromEnum y >= fromEnum x = maxBound | otherwise = minBound Methods succ :: a -> a Source the successor of a value. For numeric types, succ adds 1. pred :: a -> a Source the predecessor of a value. For numeric types, pred subtracts 1. toEnum :: Int -> a Source Convert from an Int . fromEnum :: a -> Int Source Convert to an Int . It is implementation-dependent what fromEnum returns when applied to a value that is too large to fit in an Int . enumFrom :: a -> [a] Source Used in Haskell's translation of [n..] . enumFromThen :: a -> a -> [a] Source Used in Haskell's translation of [n,n'..] . enumFromTo :: a -> a -> [a] Source Used in Haskell's translation of [n..m] . enumFromThenTo :: a -> a -> a -> [a] Source Used in Haskell's translation of [n,n'..m] . Instances Enum Bool   Enum Char   Enum Double   Enum Float   Enum Int   Enum Int8   Enum Int16   Enum Int32   Enum Int64   Enum Integer   Enum Ordering   Enum Word   Enum Word8   Enum Word16   Enum Word32   Enum Word64   Enum ()   Enum IOMode   Enum SeekMode   Enum CUIntMax   Enum CIntMax   Enum CUIntPtr   Enum CIntPtr   Enum CSUSeconds   Enum CUSeconds   Enum CTime   Enum CClock   Enum CSigAtomic   Enum CWchar   Enum CSize   Enum CPtrdiff   Enum CDouble   Enum CFloat   Enum CULLong   Enum CLLong   Enum CULong   Enum CLong   Enum CUInt   Enum CInt   Enum CUShort   Enum CShort   Enum CUChar   Enum CSChar   Enum CChar   Enum GeneralCategory   Enum IntPtr   Enum WordPtr   Enum Fd   Enum CRLim   Enum CTcflag   Enum CSpeed   Enum CCc   Enum CUid   Enum CNlink   Enum CGid   Enum CSsize   Enum CPid   Enum COff   Enum CMode   Enum CIno   Enum CDev   Integral a => Enum ( Ratio a)   Enum ( Fixed a)   class Bounded a where Source The Bounded class is used to name the upper and lower limits of a type. Ord is not a superclass of Bounded since types that are not totally ordered may also have upper and lower bounds. The Bounded class may be derived for any enumeration type; minBound is the first constructor listed in the data declaration and maxBound is the last. Bounded may also be derived for single-constructor datatypes whose constituent types are in Bounded . Methods minBound , maxBound :: a Source Instances Bounded Bool   Bounded Char   Bounded Int   Bounded Int8   Bounded Int16   Bounded Int32   Bounded Int64   Bounded Ordering   Bounded Word   Bounded Word8   Bounded Word16   Bounded Word32   Bounded Word64   Bounded ()   Bounded CUIntMax   Bounded CIntMax   Bounded CUIntPtr   Bounded CIntPtr   Bounded CSigAtomic   Bounded CWchar   Bounded CSize   Bounded CPtrdiff   Bounded CULLong   Bounded CLLong   Bounded CULong   Bounded CLong   Bounded CUInt   Bounded CInt   Bounded CUShort   Bounded CShort   Bounded CUChar   Bounded CSChar   Bounded CChar   Bounded GeneralCategory   Bounded IntPtr   Bounded WordPtr   Bounded Any   Bounded All   Bounded Fd   Bounded CRLim   Bounded CTcflag   Bounded CUid   Bounded CNlink   Bounded CGid   Bounded CSsize   Bounded CPid   Bounded COff   Bounded CMode   Bounded CIno   Bounded CDev   Bounded a => Bounded ( Product a)   Bounded a => Bounded ( Sum a)   Bounded a => Bounded ( Dual a)   ( Bounded a, Bounded b) => Bounded (a, b)   ( Bounded a, Bounded b, Bounded c) => Bounded (a, b, c)   ( Bounded a, Bounded b, Bounded c, Bounded d) => Bounded (a, b, c, d)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e) => Bounded (a, b, c, d, e)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f) => Bounded (a, b, c, d, e, f)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g) => Bounded (a, b, c, d, e, f, g)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h) => Bounded (a, b, c, d, e, f, g, h)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i) => Bounded (a, b, c, d, e, f, g, h, i)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j) => Bounded (a, b, c, d, e, f, g, h, i, j)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k) => Bounded (a, b, c, d, e, f, g, h, i, j, k)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n)   ( Bounded a, Bounded b, Bounded c, Bounded d, Bounded e, Bounded f, Bounded g, Bounded h, Bounded i, Bounded j, Bounded k, Bounded l, Bounded m, Bounded n, Bounded o) => Bounded (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)   Numbers Numeric types data Int Source A fixed-precision integer type with at least the range [-2^29 .. 2^29-1] . The exact range for a given implementation can be determined by using minBound and maxBound from the Bounded class. Instances Bounded Int   Enum Int   Eq Int   Integral Int   Data Int   Num Int   Ord Int   Read Int   Real Int   Show Int   Ix Int   Typeable Int   Generic Int   Bits Int   Storable Int   PrintfArg Int   data Integer Source Arbitrary-precision integers. Instances Enum Integer   Eq Integer   Integral Integer   Data Integer   Num Integer   Ord Integer   Read Integer   Real Integer   Show Integer   Ix Integer   Typeable Integer   Bits Integer   PrintfArg Integer   SingE Nat ( Kind Nat ) Integer   data Float Source Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type. Instances Enum Float   Eq Float   Floating Float   Fractional Float   Data Float   Num Float   Ord Float   Read Float   Real Float   RealFloat Float   RealFrac Float   Show Float   Typeable Float   Generic Float   Storable Float   PrintfArg Float   data Double Source Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type. Instances Enum Double   Eq Double   Floating Double   Fractional Double   Data Double   Num Double   Ord Double   Read Double   Real Double   RealFloat Double   RealFrac Double   Show Double   Typeable Double   Generic Double   Storable Double   PrintfArg Double   type Rational = Ratio Integer Source Arbitrary-precision rational numbers, represented as a ratio of two Integer values. A rational number may be constructed using the % operator. Numeric type classes class Num a where Source Basic numeric class. Minimal complete definition: all except negate or (-) Methods (+) , (*) , (-) :: a -> a -> a Source negate :: a -> a Source Unary negation. abs :: a -> a Source Absolute value. signum :: a -> a Source Sign of a number. The functions abs and signum should satisfy the law: abs x * signum x == x For real numbers, the signum is either -1 (negative), 0 (zero) or 1 (positive). fromInteger :: Integer -> a Source Conversion from an Integer . An integer literal represents the application of the function fromInteger to the appropriate value of type Integer , so such literals have type ( Num a) => a . Instances Num Double   Num Float   Num Int   Num Int8   Num Int16   Num Int32   Num Int64   Num Integer   Num Word   Num Word8   Num Word16   Num Word32   Num Word64   Num CUIntMax   Num CIntMax   Num CUIntPtr   Num CIntPtr   Num CSUSeconds   Num CUSeconds   Num CTime   Num CClock   Num CSigAtomic   Num CWchar   Num CSize   Num CPtrdiff   Num CDouble   Num CFloat   Num CULLong   Num CLLong   Num CULong   Num CLong   Num CUInt   Num CInt   Num CUShort   Num CShort   Num CUChar   Num CSChar   Num CChar   Num IntPtr   Num WordPtr   Num Fd   Num CRLim   Num CTcflag   Num CSpeed   Num CCc   Num CUid   Num CNlink   Num CGid   Num CSsize   Num CPid   Num COff   Num CMode   Num CIno   Num CDev   Integral a => Num ( Ratio a)   RealFloat a => Num ( Complex a)   HasResolution a => Num ( Fixed a)   class ( Num a, Ord a) => Real a where Source Methods toRational :: a -> Rational Source the rational equivalent of its real argument with full precision Instances Real Double   Real Float   Real Int   Real Int8   Real Int16   Real Int32   Real Int64   Real Integer   Real Word   Real Word8   Real Word16   Real Word32   Real Word64   Real CUIntMax   Real CIntMax   Real CUIntPtr   Real CIntPtr   Real CSUSeconds   Real CUSeconds   Real CTime   Real CClock   Real CSigAtomic   Real CWchar   Real CSize   Real CPtrdiff   Real CDouble   Real CFloat   Real CULLong   Real CLLong   Real CULong   Real CLong   Real CUInt   Real CInt   Real CUShort   Real CShort   Real CUChar   Real CSChar   Real CChar   Real IntPtr   Real WordPtr   Real Fd   Real CRLim   Real CTcflag   Real CSpeed   Real CCc   Real CUid   Real CNlink   Real CGid   Real CSsize   Real CPid   Real COff   Real CMode   Real CIno   Real CDev   Integral a => Real ( Ratio a)   HasResolution a => Real ( Fixed a)   class ( Real a, Enum a) => Integral a where Source Integral numbers, supporting integer division. Minimal complete definition: quotRem and toInteger Methods quot :: a -> a -> a Source integer division truncated toward zero rem :: a -> a -> a Source integer remainder, satisfying (x `quot` y)*y + (x `rem` y) == x div :: a -> a -> a Source integer division truncated toward negative infinity mod :: a -> a -> a Source integer modulus, satisfying (x `div` y)*y + (x `mod` y) == x quotRem :: a -> a -> (a, a) Source simultaneous quot and rem divMod :: a -> a -> (a, a) Source simultaneous div and mod toInteger :: a -> Integer Source conversion to Integer Instances Integral Int   Integral Int8   Integral Int16   Integral Int32   Integral Int64   Integral Integer   Integral Word   Integral Word8   Integral Word16   Integral Word32   Integral Word64   Integral CUIntMax   Integral CIntMax   Integral CUIntPtr   Integral CIntPtr   Integral CSigAtomic   Integral CWchar   Integral CSize   Integral CPtrdiff   Integral CULLong   Integral CLLong   Integral CULong   Integral CLong   Integral CUInt   Integral CInt   Integral CUShort   Integral CShort   Integral CUChar   Integral CSChar   Integral CChar   Integral IntPtr   Integral WordPtr   Integral Fd   Integral CRLim   Integral CTcflag   Integral CUid   Integral CNlink   Integral CGid   Integral CSsize   Integral CPid   Integral COff   Integral CMode   Integral CIno   Integral CDev   class Num a => Fractional a where Source Fractional numbers, supporting real division. Minimal complete definition: fromRational and ( recip or ( / ) ) Methods (/) :: a -> a -> a Source fractional division recip :: a -> a Source reciprocal fraction fromRational :: Rational -> a Source Conversion from a Rational (that is Ratio Integer ). A floating literal stands for an application of fromRational to a value of type Rational , so such literals have type ( Fractional a) => a . Instances Fractional Double   Fractional Float   Fractional CDouble   Fractional CFloat   Integral a => Fractional ( Ratio a)   RealFloat a => Fractional ( Complex a)   HasResolution a => Fractional ( Fixed a)   class Fractional a => Floating a where Source Trigonometric and hyperbolic functions and related functions. Minimal complete definition: pi , exp , log , sin , cos , sinh , cosh , asin , acos , atan , asinh , acosh and atanh Methods pi :: a Source exp , sqrt , log :: a -> a Source (**) , logBase :: a -> a -> a Source sin , tan , cos :: a -> a Source asin , atan , acos :: a -> a Source sinh , tanh , cosh :: a -> a Source asinh , atanh , acosh :: a -> a Source Instances Floating Double   Floating Float   Floating CDouble   Floating CFloat   RealFloat a => Floating ( Complex a)   class ( Real a, Fractional a) => RealFrac a where Source Extracting components of fractions. Minimal complete definition: properFraction Methods properFraction :: Integral b => a -> (b, a) Source The function properFraction takes a real fractional number x and returns a pair (n,f) such that x = n+f , and: n is an integral number with the same sign as x ; and f is a fraction with the same type and sign as x , and with absolute value less than 1 . The default definitions of the ceiling , floor , truncate and round functions are in terms of properFraction . truncate :: Integral b => a -> b Source truncate x returns the integer nearest x between zero and x round :: Integral b => a -> b Source round x returns the nearest integer to x ; the even integer if x is equidistant between two integers ceiling :: Integral b => a -> b Source ceiling x returns the least integer not less than x floor :: Integral b => a -> b Source floor x returns the greatest integer not greater than x Instances RealFrac Double   RealFrac Float   RealFrac CDouble   RealFrac CFloat   Integral a => RealFrac ( Ratio a)   HasResolution a => RealFrac ( Fixed a)   class ( RealFrac a, Floating a) => RealFloat a where Source Efficient, machine-independent access to the components of a floating-point number. Minimal complete definition: all except exponent , significand , scaleFloat and atan2 Methods floatRadix :: a -> Integer Source a constant function, returning the radix of the representation (often 2 ) floatDigits :: a -> Int Source a constant function, returning the number of digits of floatRadix in the significand floatRange :: a -> ( Int , Int ) Source a constant function, returning the lowest and highest values the exponent may assume decodeFloat :: a -> ( Integer , Int ) Source The function decodeFloat applied to a real floating-point number returns the significand expressed as an Integer and an appropriately scaled exponent (an Int ). If decodeFloat x yields (m,n) , then x is equal in value to m*b^^n , where b is the floating-point radix, and furthermore, either m and n are both zero or else b^(d-1) <= abs m < b^d , where d is the value of floatDigits x . In particular, decodeFloat 0 = (0,0) . If the type contains a negative zero, also decodeFloat (-0.0) = (0,0) . The result of decodeFloat x is unspecified if either of isNaN x or isInfinite x is True . encodeFloat :: Integer -> Int -> a Source encodeFloat performs the inverse of decodeFloat in the sense that for finite x with the exception of -0.0 , uncurry encodeFloat ( decodeFloat x) = x . encodeFloat m n is one of the two closest representable floating-point numbers to m*b^^n (or ±Infinity if overflow occurs); usually the closer, but if m contains too many bits, the result may be rounded in the wrong direction. exponent :: a -> Int Source exponent corresponds to the second component of decodeFloat . exponent 0 = 0 and for finite nonzero x , exponent x = snd ( decodeFloat x) + floatDigits x . If x is a finite floating-point number, it is equal in value to significand x * b ^^ exponent x , where b is the floating-point radix. The behaviour is unspecified on infinite or NaN values. significand :: a -> a Source The first component of decodeFloat , scaled to lie in the open interval ( -1 , 1 ), either 0.0 or of absolute value >= 1/b , where b is the floating-point radix. The behaviour is unspecified on infinite or NaN values. scaleFloat :: Int -> a -> a Source multiplies a floating-point number by an integer power of the radix isNaN :: a -> Bool Source True if the argument is an IEEE "not-a-number" (NaN) value isInfinite :: a -> Bool Source True if the argument is an IEEE infinity or negative infinity isDenormalized :: a -> Bool Source True if the argument is too small to be represented in normalized format isNegativeZero :: a -> Bool Source True if the argument is an IEEE negative zero isIEEE :: a -> Bool Source True if the argument is an IEEE floating point number atan2 :: a -> a -> a Source a version of arctangent taking two real floating-point arguments. For real floating x and y , atan2 y x computes the angle (from the positive x-axis) of the vector from the origin to the point (x,y) . atan2 y x returns a value in the range [ -pi , pi ]. It follows the Common Lisp semantics for the origin when signed zeroes are supported. atan2 y 1 , with y in a type that is RealFloat , should return the same value as atan y . A default definition of atan2 is provided, but implementors can provide a more accurate implementation. Instances RealFloat Double   RealFloat Float   RealFloat CDouble   RealFloat CFloat   Numeric functions subtract :: Num a => a -> a -> a Source the same as flip ( - ) . Because - is treated specially in the Haskell grammar, (- e ) is not a section, but an application of prefix negation. However, ( subtract exp ) is equivalent to the disallowed section. even :: Integral a => a -> Bool Source odd :: Integral a => a -> Bool Source gcd :: Integral a => a -> a -> a Source gcd x y is the non-negative factor of both x and y of which every common factor of x and y is also a factor; for example gcd 4 2 = 2 , gcd (-4) 6 = 2 , gcd 0 4 = 4 . gcd 0 0 = 0 . (That is, the common divisor that is "greatest" in the divisibility preordering.) Note: Since for signed fixed-width integer types, abs minBound < 0 , the result may be negative if one of the arguments is minBound (and necessarily is if the other is 0 or minBound ) for such types. lcm :: Integral a => a -> a -> a Source lcm x y is the smallest positive integer that both x and y divide. (^) :: ( Num a, Integral b) => a -> b -> a Source raise a number to a non-negative integral power (^^) :: ( Fractional a, Integral b) => a -> b -> a Source raise a number to an integral power fromIntegral :: ( Integral a, Num b) => a -> b Source general coercion from integral types realToFrac :: ( Real a, Fractional b) => a -> b Source general coercion to fractional types Monads and functors class Monad m where Source The Monad class defines the basic operations over a monad , a concept from a branch of mathematics known as category theory . From the perspective of a Haskell programmer, however, it is best to think of a monad as an abstract datatype of actions. Haskell's do expressions provide a convenient syntax for writing monadic expressions. Minimal complete definition: >>= and return . Instances of Monad should satisfy the following laws: return a >>= k == k a m >>= return == m m >>= (\x -> k x >>= h) == (m >>= k) >>= h Instances of both Monad and Functor should additionally satisfy the law: fmap f xs == xs >>= return . f The instances of Monad for lists, Maybe and IO defined in the Prelude satisfy these laws. Methods (>>=) :: forall a b. m a -> (a -> m b) -> m b Source Sequentially compose two actions, passing any value produced by the first as an argument to the second. (>>) :: forall a b. m a -> m b -> m b Source Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages. return :: a -> m a Source Inject a value into the monadic type. fail :: String -> m a Source Fail with a message. This operation is not part of the mathematical definition of a monad, but is invoked on pattern-match failure in a do expression. Instances Monad []   Monad IO   Monad Maybe   Monad ReadP   Monad ReadPrec   Monad STM   Monad ((->) r)   Monad ( Either e)   Monad ( ST s)   ArrowApply a => Monad ( ArrowMonad a)   Monad ( ST s)   class Functor f where Source The Functor class is used for types that can be mapped over. Instances of Functor should satisfy the following laws: fmap id == id fmap (f . g) == fmap f . fmap g The instances of Functor for lists, Maybe and IO satisfy these laws. Methods fmap :: (a -> b) -> f a -> f b Source Instances Functor []   Functor IO   Functor Maybe   Functor ReadP   Functor ReadPrec   Functor STM   Functor Handler   Functor ZipList   Functor ((->) r)   Functor ( Either a)   Functor ( (,) a)   Functor ( ST s)   Arrow a => Functor ( ArrowMonad a)   Functor ( ST s)   Monad m => Functor ( WrappedMonad m)   Functor ( Const m)   Arrow a => Functor ( WrappedArrow a b)   mapM :: Monad m => (a -> m b) -> [a] -> m [b] Source mapM f is equivalent to sequence . map f . mapM_ :: Monad m => (a -> m b) -> [a] -> m () Source mapM_ f is equivalent to sequence_ . map f . sequence :: Monad m => [m a] -> m [a] Source Evaluate each action in the sequence from left to right, and collect the results. sequence_ :: Monad m => [m a] -> m () Source Evaluate each action in the sequence from left to right, and ignore the results. (=<<) :: Monad m => (a -> m b) -> m a -> m b Source Same as >>= , but with the arguments interchanged. Miscellaneous functions id :: a -> a Source Identity function. const :: a -> b -> a Source Constant function. (.) :: (b -> c) -> (a -> b) -> a -> c Source Function composition. flip :: (a -> b -> c) -> b -> a -> c Source flip f takes its (first) two arguments in the reverse order of f . ($) :: (a -> b) -> a -> b Source Application operator. This operator is redundant, since ordinary application (f x) means the same as (f $ x) . However, $ has low, right-associative binding precedence, so it sometimes allows parentheses to be omitted; for example: f $ g $ h x = f (g (h x)) It is also useful in higher-order situations, such as map ( $ 0) xs , or zipWith ( $ ) fs xs . until :: (a -> Bool ) -> (a -> a) -> a -> a Source until p f yields the result of applying f until p holds. asTypeOf :: a -> a -> a Source asTypeOf is a type-restricted version of const . It is usually used as an infix operator, and its typing forces its first argument (which is usually overloaded) to have the same type as the second. error :: [ Char ] -> a Source error stops execution and displays an error message. undefined :: a Source A special case of error . It is expected that compilers will recognize this and insert error messages which are more appropriate to the context in which undefined appears. seq :: a -> b -> b Source Evaluates its first argument to head normal form, and then returns its second argument as the result. ($!) :: (a -> b) -> a -> b Source Strict (call-by-value) application, defined in terms of seq . List operations map :: (a -> b) -> [a] -> [b] Source map f xs is the list obtained by applying f to each element of xs , i.e., map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] map f [x1, x2, ...] == [f x1, f x2, ...] (++) :: [a] -> [a] -> [a] Source Append two lists, i.e., [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...] If the first list is not finite, the result is the first list. filter :: (a -> Bool ) -> [a] -> [a] Source filter , applied to a predicate and a list, returns the list of those elements that satisfy the predicate; i.e., filter p xs = [ x | x <- xs, p x] head :: [a] -> a Source Extract the first element of a list, which must be non-empty. last :: [a] -> a Source Extract the last element of a list, which must be finite and non-empty. tail :: [a] -> [a] Source Extract the elements after the head of a list, which must be non-empty. init :: [a] -> [a] Source Return all the elements of a list except the last one. The list must be non-empty. null :: [a] -> Bool Source Test whether a list is empty. length :: [a] -> Int Source O(n) . length returns the length of a finite list as an Int . It is an instance of the more general genericLength , the result type of which may be any kind of number. (!!) :: [a] -> Int -> a Source List index (subscript) operator, starting from 0. It is an instance of the more general genericIndex , which takes an index of any integral type. reverse :: [a] -> [a] Source reverse xs returns the elements of xs in reverse order. xs must be finite. Reducing lists (folds) foldl :: (a -> b -> a) -> a -> [b] -> a Source foldl , applied to a binary operator, a starting value (typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right: foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn The list must be finite. foldl1 :: (a -> a -> a) -> [a] -> a Source foldl1 is a variant of foldl that has no starting value argument, and thus must be applied to non-empty lists. foldr :: (a -> b -> b) -> b -> [a] -> b Source foldr , applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left: foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...) foldr1 :: (a -> a -> a) -> [a] -> a Source foldr1 is a variant of foldr that has no starting value argument, and th
2026-01-13T09:30:24
https://github.com/zenspider
zenspider (Ryan Davis) · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection Stop leaks before they start EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events & webinars Ebooks & reports Business insights GitHub Skills SUPPORT & SERVICES Documentation Customer support Community forum Trust center Partners Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} zenspider Follow Overview Repositories 73 Projects 0 Packages 0 Stars 50 More Overview Repositories Projects Packages Stars zenspider Follow 🌈 It's complicated? Ryan Davis zenspider 🌈 It's complicated? Follow Sponsor Founder of @seattlerb . Author of minitest & many other gems. NO Recruiters! 834 followers · 16 following Seattlerb Consulting Seattle, WA https://www.zenspider.com/ Mastodon @zenspider@ruby.social Sponsors Private Sponsor Organizations Block or Report Block or report zenspider --> Block user Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users . You must be logged in to block users. Add an optional note Maximum 250 characters. Please don't include any personal information such as legal names or email addresses. Markdown supported. This note will be visible to only you. Block user Report abuse Contact GitHub support about this user’s behavior. Learn more about reporting abuse . Report abuse Overview Repositories 73 Projects 0 Packages 0 Stars 50 More Overview Repositories Projects Packages Stars Pinned Loading minitest/ minitest minitest/minitest Public minitest provides a complete suite of testing facilities supporting TDD, BDD, and benchmarking. Ruby 3.4k 579 enhanced-ruby-mode enhanced-ruby-mode Public Forked from jacott/Enhanced-Ruby-Mode An enhanced ruby-mode for Emacs that uses Ripper in ruby 1.9+ to highlight and indent the source code Emacs Lisp 224 58 seattlerb/ flog seattlerb/flog Public Flog reports the most tortured code in an easy to read pain report. The higher the score, the more pain the code is in. Ruby 960 75 seattlerb/ flay seattlerb/flay Public Flay analyzes code for structural similarities. Differences in literal values, variable, class, method names, whitespace, programming style, braces vs do/end, etc are all ignored. Ruby 758 59 seattlerb/ debride seattlerb/debride Public Analyze code for potentially uncalled / dead methods, now with auto-removal. Ruby 745 17 seattlerb/ ruby_parser seattlerb/ruby_parser Public ruby_parser is a ruby parser written in pure ruby. It outputs s-expressions which can be manipulated and converted back to ruby via the ruby2ruby gem. Ruby 481 99 Something went wrong, please refresh the page to try again. If the problem persists, check the GitHub status page or contact support . Uh oh! There was an error while loading. Please reload this page . Footer © 2026 GitHub, Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time.
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/types#sidebar
don't count on finding me: types skip to main | skip to sidebar don't count on finding me Showing posts with label types . Show all posts Showing posts with label types . Show all posts Sunday, January 9, 2011 Quantifiers: Dark Matter Modern cosmology routinely deals with dark matter , a source of gravity necessary to explain certain things. In the last days I discovered a kind of dark matter in Ωmega too, and here is the related story. As we know type constructors arise when the data definition is equipped with parameters, like below: data Tree a = Tip a | Fork (Tree a) (Tree a) a is a type variable and gets instantiated (to a type) when we want the tree to contain actual information. Actually I could have written the second recursive occurrence of Tree a in the Fork branch as Tree Char , and the type checker would have accepted it. Why? Because at each instantiation site the type variable a is created fresh , and can be bound to a new expression. But what is the kind of a ? In Haskell it can only be * , which classifies all types, as the other possible kinds ( * → * , etc.) do not classify types. But this kinding relation is not spelled out directly, so let's choose a more explicit definition: data Tree :: * → * where ... When talking about Tree Integer , then it gets pretty clear that Integer 's kind must be * and that the resulting  Tree Integer is itself kinded by * . But there is a fine distinction between explicit and implicit kinding in Ωmega: in the latter case a is kinded by a unification variable instead of by * . The reason is that Ωmega allows us to define custom kinds, which can classify other type-like things. These are usually used for indexing of type constructors. The unification variables that are present, but hidden from the user only become manifest when we have multiple levels of data definitions, with the higher levels indexing the lower ones and some constructor function tries to bind the unification variable to different kinds. Of course that won't work and all you'll see is a very cryptic error message. The smallest example I have encountered is issue 70 , which I will present as an example here. data Pat :: *3 where   Q :: Pat ~> Pat data Pat' :: Pat ~> *2 where   Q' :: Pat' n ~> Pat' (Q n) data Pat'' :: Pat' p ~> *1 where   Q'' :: Pat'' n ~> Pat'' (Q' n) data Pat''' :: Pat'' p ~> *0 where   Q :: Pat''' n → Pat''' (Q'' n) Look at the last line, it induces these two kind equations: n = Pat'' p1 Q'' n = Pat'' p2 Each equality at some level induces an equality at one level up. But p1 and p2 are kinded by the same unification variable, k . Let's note the two equations with k in the middle: m = k = Q' m where m is the kind of n . You can see now that m is forced to be equal to Q' m , which is clearly incommensurable. The solution is clearly to spell out kinding quantifiers explicitly with type variables. Since these get instantiated to fresh copies on the fly, the above problem does not occur. So we arrive at (only showing the last definition for brevity's sake) data Pat''' :: forall (o::Pat) (p::Pat' o) . Pat'' p ~> *0 where   Q :: Pat''' n → Pat''' (Q'' n) Black magic? Only when you let the kinds live in the dark! Posted by heisenbug at 12:38 PM No comments: Labels: omega , types Tuesday, November 23, 2010 Hats off The types subreddit references Chuan-kai Lin's PhD thesis about GADT type inference. I already have read the pointwise paper , but this is of course a revelation. He actually did implement an algorithm that inferred types for 25 (out of 30) little benchmark programs with GADTs. Previous attempts accomplished at most one! But the thing that impressed me the most wasn't the technical side of his story but the beautifully crafted slides of his PhD defense talk. I am baffled... Congratulations Chuan-kai! Posted by heisenbug at 6:09 PM No comments: Labels: GADT , types Friday, June 18, 2010 Sized types I have always liked the idea of assigning some notion of size to (tree-like) values, and track its changes along pattern matching and construction to be able to reason about termination-unaffecting recursive calls. Many years ago, when reading the Hughes-Pareto-Sabry paper I did not see the point yet why termination is fundamental in various aspects. Only when sitting on the park bench on the isle of Margitsziget (Budapest) and discussing with Tim about sound logic in Ωmega, it dawned to me how termination checking with sized types can be exploited. I developed the intuition of the tree-like data floating heads down in the water and we are reasoning about criteria that it can still float without touching the ground at depth n . Still, this metaphor was rather hazy. In the meantime I have tried to digest the relevant papers from Barthe and Abel, brainstormed somewhat here and let my brain background. Yesterday, I found (on reddit) a link to Abel's new MiniAgda implementation and its description. It made clear to me that my early intuition was not bad at all, the water depth is the upper limit of the size, and recursion is to reduce this to obtain a well-founded induction. Now it is time to rethink my ideas about infinite function types and how they can be reconciled with sized types. But it looks like Abel has done the hard work and his Haskell implementation of MiniAgda could be married with Ωmega in the following way: Derive a sized variant of every (suitable) Ωmega datatype and try to check which functions on them terminate. These can be used as theorems in Ωmega. Hopefully Tim is paying attention to this when implementing Trellys... Posted by heisenbug at 12:01 PM No comments: Labels: omega , termination , types Wednesday, September 12, 2007 Comonads Slowly recovering from vacation-induced ignorance, today I printed out some interesting papers about type-preserving compilation , plans for type-level functions in GHC and dataflow implementations using comonads . Another one about Hoare Type Systems remained on my screen, too heavy for me, a.t.m. So I am wrapping my head around category theory again. Somehow all these topics seems to interact, and I continuously am trying to fit them into my Thrist framework. Today I tried to implement a Comonad to Thrist adapter (in my mind at least, no code written yet). Posted by heisenbug at 4:50 PM No comments: Labels: category theory , types Saturday, July 7, 2007 Tail Merging in Ωmega Today finally I got around improving my Cat-like language optimizer with a new twist: I can finally factor out common instructions from the end of the two If legs and prepend them to the If 's continuation. This wouldn't be an interesting achievement if it wouldn't be written in Ωmega 's type-pedantic fragment. To wit: tailMerge False [If [Dup]l [Dup]l, Print]l (revThrist' [Dup]l) (revThrist' [Dup]l) [Print]l becomes: [(PopN 1v),Dup,Print]l : forall a (b:Prod *0).Thrist Cat [Bool,a; b]sh [a; b]sh If you think the above lines are in Chinese, you can stop now. If you discover that the If has completely been eliminated and replaced by popping a boolean and duplicating the TOS , then you are pretty good in reading obscure code. The funny thing is that all the types of values that are on the stack are painstakingly tracked, and the transformation is automatically type correct in Cat because it is type checked in the metalanguage . I am sure that similar transformations have been proven type correct (and thus pretty correct) before, however I would like to know whether this particular optimization has been already formalized using expressive types. The big surprise for me was the fact that writing down the transformation only needed a dozen lines of code, support functions included. Of course, my proof of concept only matches on Dup instructions, but the rest is basically boilerplate. The second surprise is, that so far I did not need a single theorem declaration, an indication that either I am still in very shallow waters regarding the power of Ωmega's typechecker, or my Thrist construction is so clever that it provides enough type hints to the narrowing engine to deduce all types. I am in the process of writing a paper on all this, and - as always - need some encouragement. Tail merging will definitely belong to the beef part of it. Posted by heisenbug at 4:18 PM No comments: Labels: omega , optimization , types Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/crazy
don't count on finding me: crazy skip to main | skip to sidebar don't count on finding me Showing posts with label crazy . Show all posts Showing posts with label crazy . Show all posts Thursday, November 25, 2010 Type Synonyms Generalized Type functions are the new trend. Ωmega has them with the following syntax: tfun :: Nat ~> Nat {tfun Z} = S Z Haskell (that is GHC) has them in the flavor of type families. It has just occurred to me that they can be considered as a syntactic relaxation of type synonyms! Look: tfun :: Nat ~> Nat type tfun Z = S Z type tfun (S n) = Z When conventional type synonyms are used they must be fully applied. This should be the case here too. I am not sure whether type families or Ωmega-style type functions can be partially applied, though. Anyway, a bit more to write at the definition site but less curlies to type at the call site; it may well be worth it. Posted by heisenbug at 3:06 PM No comments: Labels: crazy , haskell , omega Patterns and Existentials I am reading papers again and this always activates my creative fantasy. I want to explain a small revelation I had just now. Patterns are the same thing as declaring existential values corresponding to all pattern variables according to their respective types as stated in their respective constructors and asserting that the pattern interpreted as a value is the same as the scrutinee. The body behind the pattern in turn is similarly evaluated with the existential variables in scope. Of course the existential values are filled in by some oracle which is uninteresting from the typing perspective. A strong corollary of the asserted value identity is that we can also assert that the type of the scrutinee unifies with the type of the pattern-value (in the scope of the existentials, but not outside of it)! Just as universally quantified values are typed by dependent products (∏-stuff) the existentially quantified values are typed by dependent sums (∑-stuff). Note that the stuff is at stratum 1, e.g. types. This is in contrast to the Haskell data declaration data Foo = forall a . Foo a where a is at stratum 1, being an existential type . Hmm, when thinking this to the end we may either end up at the conventional non-inference for GADTs or something like the generalized existentials as proposed in Chuan-kai Lin's thesis. I conjecture also that this is the same thing as the post-facto type inference I suggested here . Now all remains to is to reinterpret function calls as a data type being a tuple with existential values and to apply the above trick. Posted by heisenbug at 2:21 PM No comments: Labels: crazy , GADT , haskell Saturday, August 30, 2008 Generalized Monads --> Gonads :-) Here is the usual (basic) definition of monads: class Monad m where return :: a -> m a (>>=) :: m a -> (a -> m b) -> m b This is very much restricted to ordinary function types! Let's see how this restriction can be lifted... class Category (~>) => Geonad (g (~>)) where return :: a ~> g (~>) a (>>=) :: g (~>) a ~> (a ~> g (~>) b) ~> g (~>) b Since the semantics of gonads are already eminently taken, I settled for the name Geonad. No idea whether this can produce something relevant for our lives :-) Cheers,       Gabor Posted by heisenbug at 4:25 AM No comments: Labels: crazy , generalization , haskell , monads Saturday, April 19, 2008 Absolutely, Positively Crazy My previous two posts revolved around space optimizations in LLVM. The presented technique is a bit unconventional, and paired with the confusing nature of def-use chains , it can leave one quite puzzled... Today in the LLVM IRC channel, chandlerc wondered whether I am eliminating the Value* from the Use struct. I corrected him, that, no, it is all about eliminating User* . But his question drove a nail im my head, making me think. After all, he was thinking of the def-use chain, and I was always dealing with user-use arrays. But deeply inside it is the same problem, a.k.a. the dual one: for a user-use array the User* for all array members is constant, while the def s ( Value* -s) vary, for a def-use chain on the other hand the def s ( Value* -s) are invariant, while the User* -s vary. I wondered whether it is feasible to use the tagging technique to get rid of the Use::Val too? After all, it is just a linked list, and I have already demonstrated something similar in my previous posts. It turns out that it is perfectly feasible, and the rest of this post demonstrates how... ...but please do not misunderstand, I do not propose this for LLVM (yet?). Let's recapitulate what a def->use chain is: There is an instruction that generates a value, thus def ining it: +-------+ Val = | Instr | +-------+ Then there are other instructions which consume this value, but the above instruction only sees the Use objects chained up: +-------+ | Instr | +----+--+ | +---+ +---+ +---+ +---->|Use|--->|Use|--->|Use|---X +---+ +---+ +---+ The X above means that Use::Next is filled with NULL. Otherwise Use::Next obviously contains the pointer to the next Use object. So to apply waymarking we have to get away with two obstacles: There is no way to store something around the Use object (layout-wise), as we did with user-use arrays. We cannot go outside to place the Value* . Def-use chains can be expanded and shrunk dynamically. It turns out that 1) is pretty easy, we do not store NULL in the last Use 's Next field, but the Value* , with the ‹fullstop› waymark. So when we see ‹fullstop›, the Value* can be extracted from the upper bits. So, let's assume the ‹stop› and ‹0›, ‹1› waymarks are also tucked on the Use::Next fields. Like usual, given any Use* we can pick up the digits, and at the ‹stop› we convert the digits to a Value* and we are done. This is nice and dandy, until we remember 2). It appears a bit more tricky. Obviously the insertion/deletion will remove waymarks or add new ones. Our algorithm may begin producing bogus Value* -s. So is there any solution to this problem? I believe there is. I have no proof but I conjecture that each destructive operation should simply place a ‹stop›, and when the algorithm is changed to only accept 32 digits between two ‹stop›s, then we are on the safe side. The corruption gets detected, an uncorrupted segment can still be found, downstream. The corruption can be repaired later (e.g. when traversing the def-use chain). Well this is not a very efficient way of doing things, so it probably only pays off when space is extremely limited and compilation/optimization speed is not paramount. But in these applications an 8-byte (down from 16/12 bytes) Use struct is definitely tempting. Posted by heisenbug at 1:49 AM No comments: Labels: algorithm , crazy , llvm , waymarking Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24
http://heisenbug.blogspot.com/search/label/types#main
don't count on finding me: types skip to main | skip to sidebar don't count on finding me Showing posts with label types . Show all posts Showing posts with label types . Show all posts Sunday, January 9, 2011 Quantifiers: Dark Matter Modern cosmology routinely deals with dark matter , a source of gravity necessary to explain certain things. In the last days I discovered a kind of dark matter in Ωmega too, and here is the related story. As we know type constructors arise when the data definition is equipped with parameters, like below: data Tree a = Tip a | Fork (Tree a) (Tree a) a is a type variable and gets instantiated (to a type) when we want the tree to contain actual information. Actually I could have written the second recursive occurrence of Tree a in the Fork branch as Tree Char , and the type checker would have accepted it. Why? Because at each instantiation site the type variable a is created fresh , and can be bound to a new expression. But what is the kind of a ? In Haskell it can only be * , which classifies all types, as the other possible kinds ( * → * , etc.) do not classify types. But this kinding relation is not spelled out directly, so let's choose a more explicit definition: data Tree :: * → * where ... When talking about Tree Integer , then it gets pretty clear that Integer 's kind must be * and that the resulting  Tree Integer is itself kinded by * . But there is a fine distinction between explicit and implicit kinding in Ωmega: in the latter case a is kinded by a unification variable instead of by * . The reason is that Ωmega allows us to define custom kinds, which can classify other type-like things. These are usually used for indexing of type constructors. The unification variables that are present, but hidden from the user only become manifest when we have multiple levels of data definitions, with the higher levels indexing the lower ones and some constructor function tries to bind the unification variable to different kinds. Of course that won't work and all you'll see is a very cryptic error message. The smallest example I have encountered is issue 70 , which I will present as an example here. data Pat :: *3 where   Q :: Pat ~> Pat data Pat' :: Pat ~> *2 where   Q' :: Pat' n ~> Pat' (Q n) data Pat'' :: Pat' p ~> *1 where   Q'' :: Pat'' n ~> Pat'' (Q' n) data Pat''' :: Pat'' p ~> *0 where   Q :: Pat''' n → Pat''' (Q'' n) Look at the last line, it induces these two kind equations: n = Pat'' p1 Q'' n = Pat'' p2 Each equality at some level induces an equality at one level up. But p1 and p2 are kinded by the same unification variable, k . Let's note the two equations with k in the middle: m = k = Q' m where m is the kind of n . You can see now that m is forced to be equal to Q' m , which is clearly incommensurable. The solution is clearly to spell out kinding quantifiers explicitly with type variables. Since these get instantiated to fresh copies on the fly, the above problem does not occur. So we arrive at (only showing the last definition for brevity's sake) data Pat''' :: forall (o::Pat) (p::Pat' o) . Pat'' p ~> *0 where   Q :: Pat''' n → Pat''' (Q'' n) Black magic? Only when you let the kinds live in the dark! Posted by heisenbug at 12:38 PM No comments: Labels: omega , types Tuesday, November 23, 2010 Hats off The types subreddit references Chuan-kai Lin's PhD thesis about GADT type inference. I already have read the pointwise paper , but this is of course a revelation. He actually did implement an algorithm that inferred types for 25 (out of 30) little benchmark programs with GADTs. Previous attempts accomplished at most one! But the thing that impressed me the most wasn't the technical side of his story but the beautifully crafted slides of his PhD defense talk. I am baffled... Congratulations Chuan-kai! Posted by heisenbug at 6:09 PM No comments: Labels: GADT , types Friday, June 18, 2010 Sized types I have always liked the idea of assigning some notion of size to (tree-like) values, and track its changes along pattern matching and construction to be able to reason about termination-unaffecting recursive calls. Many years ago, when reading the Hughes-Pareto-Sabry paper I did not see the point yet why termination is fundamental in various aspects. Only when sitting on the park bench on the isle of Margitsziget (Budapest) and discussing with Tim about sound logic in Ωmega, it dawned to me how termination checking with sized types can be exploited. I developed the intuition of the tree-like data floating heads down in the water and we are reasoning about criteria that it can still float without touching the ground at depth n . Still, this metaphor was rather hazy. In the meantime I have tried to digest the relevant papers from Barthe and Abel, brainstormed somewhat here and let my brain background. Yesterday, I found (on reddit) a link to Abel's new MiniAgda implementation and its description. It made clear to me that my early intuition was not bad at all, the water depth is the upper limit of the size, and recursion is to reduce this to obtain a well-founded induction. Now it is time to rethink my ideas about infinite function types and how they can be reconciled with sized types. But it looks like Abel has done the hard work and his Haskell implementation of MiniAgda could be married with Ωmega in the following way: Derive a sized variant of every (suitable) Ωmega datatype and try to check which functions on them terminate. These can be used as theorems in Ωmega. Hopefully Tim is paying attention to this when implementing Trellys... Posted by heisenbug at 12:01 PM No comments: Labels: omega , termination , types Wednesday, September 12, 2007 Comonads Slowly recovering from vacation-induced ignorance, today I printed out some interesting papers about type-preserving compilation , plans for type-level functions in GHC and dataflow implementations using comonads . Another one about Hoare Type Systems remained on my screen, too heavy for me, a.t.m. So I am wrapping my head around category theory again. Somehow all these topics seems to interact, and I continuously am trying to fit them into my Thrist framework. Today I tried to implement a Comonad to Thrist adapter (in my mind at least, no code written yet). Posted by heisenbug at 4:50 PM No comments: Labels: category theory , types Saturday, July 7, 2007 Tail Merging in Ωmega Today finally I got around improving my Cat-like language optimizer with a new twist: I can finally factor out common instructions from the end of the two If legs and prepend them to the If 's continuation. This wouldn't be an interesting achievement if it wouldn't be written in Ωmega 's type-pedantic fragment. To wit: tailMerge False [If [Dup]l [Dup]l, Print]l (revThrist' [Dup]l) (revThrist' [Dup]l) [Print]l becomes: [(PopN 1v),Dup,Print]l : forall a (b:Prod *0).Thrist Cat [Bool,a; b]sh [a; b]sh If you think the above lines are in Chinese, you can stop now. If you discover that the If has completely been eliminated and replaced by popping a boolean and duplicating the TOS , then you are pretty good in reading obscure code. The funny thing is that all the types of values that are on the stack are painstakingly tracked, and the transformation is automatically type correct in Cat because it is type checked in the metalanguage . I am sure that similar transformations have been proven type correct (and thus pretty correct) before, however I would like to know whether this particular optimization has been already formalized using expressive types. The big surprise for me was the fact that writing down the transformation only needed a dozen lines of code, support functions included. Of course, my proof of concept only matches on Dup instructions, but the rest is basically boilerplate. The second surprise is, that so far I did not need a single theorem declaration, an indication that either I am still in very shallow waters regarding the power of Ωmega's typechecker, or my Thrist construction is so clever that it provides enough type hints to the narrowing engine to deduce all types. I am in the process of writing a paper on all this, and - as always - need some encouragement. Tail merging will definitely belong to the beef part of it. Posted by heisenbug at 4:18 PM No comments: Labels: omega , optimization , types Older Posts Home Subscribe to: Comments (Atom) Blog Archive ▼  2022 (1) ▼  February (1) Pattern musings ►  2014 (5) ►  November (1) ►  October (1) ►  August (1) ►  July (1) ►  January (1) ►  2013 (5) ►  September (1) ►  August (3) ►  February (1) ►  2012 (2) ►  December (1) ►  September (1) ►  2011 (7) ►  December (1) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  February (1) ►  January (1) ►  2010 (19) ►  December (5) ►  November (6) ►  October (1) ►  August (1) ►  July (2) ►  June (4) ►  2009 (12) ►  November (2) ►  October (1) ►  August (1) ►  June (1) ►  May (1) ►  March (4) ►  January (2) ►  2008 (22) ►  October (1) ►  September (3) ►  August (6) ►  July (3) ►  June (2) ►  May (1) ►  April (3) ►  March (1) ►  February (1) ►  January (1) ►  2007 (20) ►  December (2) ►  November (1) ►  October (1) ►  September (1) ►  August (1) ►  July (14) About Me heisenbug I am here and there. You may encounter me if you try, but no guarantees. Just a hint: I am mostly with my family. View my complete profile  
2026-01-13T09:30:24