Hoogle Search
Within LTS Haskell 24.49 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
forever :: Applicative f => f a -> f bbasic-prelude BasicPrelude Repeat an action indefinitely.
Examples
A common use of forever is to process input from network sockets, Handles, and channels (e.g. MVar and Chan). For example, here is how we might implement an echo server, using forever both to listen for client connections on a network socket and to echo client input on client connection handles:echoServer :: Socket -> IO () echoServer socket = forever $ do client <- accept socket forkFinally (echo client) (\_ -> hClose client) where echo :: Handle -> IO () echo client = forever $ hGetLine client >>= hPutStrLn client
Note that "forever" isn't necessarily non-terminating. If the action is in a MonadPlus and short-circuits after some number of iterations. then forever actually returns mzero, effectively short-circuiting its caller.forceAttrMap :: Attr -> AttrMapbrick Brick.AttrMap Create an attribute map in which all lookups map to the same attribute. This is functionally equivalent to attrMap attr [].
forceAttrMapAllowStyle :: Attr -> AttrMap -> AttrMapbrick Brick.AttrMap Create an attribute map in which all lookups map to the same attribute. This is functionally equivalent to attrMap attr [].
-
brick Brick.Forms The namespace for the other form attributes.
formFieldExternallyValid :: FormField a b e n -> Boolbrick Brick.Forms Whether the field is valid according to an external validation source. Defaults to always being True and can be set with setFieldValid. The value of this field also affects the behavior of allFieldsValid and getInvalidFields.
formFieldHandleEvent :: FormField a b e n -> BrickEvent n e -> EventM n b ()brick Brick.Forms An event handler for this field.
formFieldName :: FormField a b e n -> nbrick Brick.Forms The name identifying this form field.
formFieldRender :: FormField a b e n -> Bool -> b -> Widget nbrick Brick.Forms A function to render this form field. Parameters are whether the field is currently focused, followed by the field state.
formFieldValidate :: FormField a b e n -> b -> Maybe abrick Brick.Forms A validation function converting this field's state into a value of your choosing. Nothing indicates a validation failure. For example, this might validate an Editor state value by parsing its text contents as an integer and return Maybe Int. This is for pure value validation; if additional validation is required (e.g. via IO), use this field's state value in an external validation routine and use setFieldValid to feed the result back into the form.
formFocus :: Form s e n -> FocusRing nbrick Brick.Forms The focus ring for the form, indicating which form field has input focus.