iconv-typed: Type safe iconv wrapper

[ bsd3, library, web ] [ Propose Tags ]
Type safe iconv wrapper

An experiment in bringing type safety to the iconv package.

Usage Example

This is almost a drop-in replacement. Compare the original code from iconv:

module Main where

import Codec.Text.IConv

main :: IO ()
main = print $ convert "UTF-8" "LATIN1" "hello"

With the equivalent in iconv-typed:

module Main where

import Codec.Text.IConv.Typed

main :: IO ()
main = print $ convert @"UTF-8" @"LATIN1" "hello"

As a result, this code will compile and run only if the passed encoding resolves to a supported encoding (as retrieved at compile time by calling "iconv -l"). For example, the following won't compile:

main = print $ convert @"UFT-8" "LATIN1" "hello"

As UFT is mispelled.

Using GHC < 8.0 that doesn't supports TypeInType? No problem, we've got you covered!

module Main where

import Codec.Text.IConv.Typed

main :: IO ()
main = print $ convert (E :: E "UTF-8") (E :: E "LATIN1") "hello"
Dependencies base (>=4.7 && <5), bytestring, iconv (<0.5), shelly (<, template-haskell (<, text (< [details]
License BSD-3-Clause
Copyright 2016 Alfredo Di Napoli
Author Alfredo Di Napoli
Maintainer alfredo.dinapoli@gmail.com
Category Web
Home page https://github.com/adinapoli/iconv-typed#readme
Source repo head: git clone https://github.com/adinapoli/iconv-typed
Uploaded by AlfredoDiNapoli at Tue Oct 25 19:22:16 UTC 2016
Distributions NixOS:
Downloads 515 total (9 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-19 [all 7 reports]
Hackage Matrix CI


  • Codec
    • Text
      • IConv
        • Codec.Text.IConv.Typed
          • Codec.Text.IConv.Typed.TH


Maintainer's Corner

For package maintainers and hackage trustees