MyNixOS website logo
Description

Lens-based HTTP toolkit.

This package provides the core functionality of the Nero HTTP toolkit.

Check the README for a more detailed explanation.

Nero

A Lens-based HTTP toolkit.

:warning: The following is a declaration of intentions. Expect wild changes in the API until the 1.0.0 release.

  • Not a framework: it may be considered an anti-framework, micro-framework, or just a "library", in the sense that it provides a set of utilities for building custom web applications instead of creating applications from user provided code following certain structure.

  • Pay for what you eat: instead of coming with everything and the kitchen sink, it provides the bare minimum to write applications with minimum implicit behavior. At the same time, it offers diverse paths to grow with you as applications become more complex.

  • Unopinonated: there is no preferred routing method, HTML templating library, session management, web server or database adapter. It comes with some defaults to alleviate the paradox of choice, but most components are expected to be easily swapped in and out either with plain 3rd party Haskell libraries or by writing thin adapters around them.

  • Power of Haskell and Lens: the Lens-based API enables a style familiar to imperative programmers Lens while being purely functional under the hood. Veteran Haskellers can take advantage of the powerful lens combinators.

Hackage Version Build Status

Example

{-# LANGUAGE OverloadedStrings #-}
import Nero.Prelude
import Nero (Request, Response, _GET, prefixed, ok)
import Nero.Warp (serve) -- from `nero-warp`

app :: Request -> Maybe Response
app request = request ^? _GET . prefixed "/hello/" <&> \name ->
    ok $ "<h1>Hello " <> name <> "</h1>"

main :: IO ()
main = serve 8080 app

More examples in the examples directory.

Metadata

Version

0.3.1

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows