linnet: Lightweight library for building HTTP API

[ library, linnet ] [ Propose Tags ]
Versions [RSS],,,,,,
Dependencies base (>=4.7 && <5), bytestring (>=, bytestring-conversion (>=0.3.1), case-insensitive (>=, either (>=, exceptions (>=0.10.3), http-media (>=, http-types (>=0.12.3), mtl (>=2.2.2), text (>=, time (>=, transformers (>=, uri-encode (>=, wai (>=, warp (>=3.2.28) [details]
License LicenseRef-Apache
Copyright 2019 Sergey Kolbasov
Author Sergey Kolbasov
Category linnet
Home page
Bug tracker
Source repo head: git clone
Uploaded by sergeykolbasov at 2019-09-18T20:36:32Z
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 2682 total (20 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-09-18 [all 1 reports]

Readme for linnet-

[back to package description]


Linnet [ˈlɪnɪt] is a lightweight Haskell library for building HTTP API on top of WAI. Library design is heavily inspired by Scala Finch.

Check out for documentation.


Travis (.com) branch Gitter Hackage

Hello world

Here is an example of running simple application using Warp server:

{-# LANGUAGE FlexibleInstances      #-}
{-# LANGUAGE MultiParamTypeClasses  #-}
{-# LANGUAGE OverloadedStrings      #-}
{-# LANGUAGE TypeApplications       #-}
{-# LANGUAGE TypeSynonymInstances   #-}

import Control.Exception (SomeException)
import Data.Function     ((&))
import Data.Text         (Text, append)
import Linnet
import Network.Wai       (Application)

-- Linnet makes no assumption on how to encode exceptions.
-- It's necessary to define encoder of exceptions for used content-types.
-- Here it returns no content
instance Encode TextPlain SomeException where
  encode _ = mempty

helloName :: Endpoint IO Text
helloName = get(p' "hello" // path @Text) ~>>
               (\name -> return $ ok ("Hello, " `append` name))

app :: Application
app = bootstrap @TextPlain helloName & compile & toApp

main :: IO ()
main = run 9000 app

Now try to call your application with:

curl -v http://localhost:9000/hello/linnet



Licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.