wreq-stringless

Simple wrapper to use wreq without Strings

https://github.com/j-keck/wreq-stringless#readme

Version on this page:0.5.1.0
LTS Haskell 22.13:0.5.9.1
Stackage Nightly 2024-03-14:0.5.9.1
Latest on Hackage:0.5.9.1

See all snapshots wreq-stringless appears in

MIT licensed by Juergen Keck
Maintained by Juergen Keck
This version can be pinned in stack with:wreq-stringless-0.5.1.0@sha256:35ad541712347c4aa922bdbbb30aa88e0cef95b91e0e18882496667bdb9807b0,2492

wreq-stringless: Simple wrapper to use wreq without Strings

This Haskell library wraps Network.Wreq to use the functions without Strings.

You can use:

  • Data.Text
  • Data.Text.Lazy
  • Data.ByteString.UTF8
  • Data.ByteString.Layz.UTF8

for all functions from Network.Wreq where the original implementation use Strings.

Example:

{-# LANGUAGE OverloadedStrings #-}
module Main where

import qualified Data.Text               as T
import           Lens.Micro.Extras       (view)
import qualified Network.Wreq            as Wreq
import qualified Network.Wreq.StringLess as Wreq'


-- say we use a alternate prelude like 'Protolude', and we don't use Strings
-- or we have the url from somewhere else, and it's not a String.
url :: T.Text
url = "http://httpbin.org"


main :: IO ()
main = do
  -- with plain wreq
  view Wreq.responseStatus  <$> Wreq.get (T.unpack url) >>= print

  -- with wreq-stringless - no manual conversion necessary
  view Wreq'.responseStatus <$> Wreq'.get url >>= print

How to use it:

  • replace your wreq dependency with wreq-stringless
  • replace the import Network.Wreq with Network.Wreq.StringLess

The versions of this library correspond with the version of wreq. So if you need wreq-0.5.1.0 you add wreq-stringless-0.5.1.0 as a dependency.

If you use stack, add the following yaml snippet to your ‘stack.yaml’

extra-deps:
  - wreq-stringless-0.5.1.0