iconv-typed-0.2.0.0: iconv-typed.cabal
name: iconv-typed
version: 0.2.0.0
synopsis: Type safe iconv wrapper
homepage: https://github.com/adinapoli/iconv-typed#readme
license: BSD3
license-file: LICENSE
author: Alfredo Di Napoli
maintainer: alfredo.dinapoli@gmail.com
copyright: 2016 Alfredo Di Napoli
category: Web
build-type: Simple
cabal-version: >=1.10
description:
[Type safe iconv wrapper]
.
An experiment in bringing type safety to the <http://hackage.haskell.org/package/iconv 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"
library
hs-source-dirs: src
exposed-modules: Codec.Text.IConv.Typed
Codec.Text.IConv.Typed.TH
build-depends: base >= 4.7 && < 5,
iconv < 0.5,
shelly < 1.8.0.0,
text < 1.4.0.0,
template-haskell < 3.0.0.0,
bytestring
default-language: Haskell2010
ghc-options: -Wall
if impl(ghc >= 8.0)
other-modules: Codec.Text.IConv.Typed.TypeInTypeAPI
else
other-modules: Codec.Text.IConv.Typed.VerboseAPI
if os(darwin)
other-modules: Codec.Text.IConv.Typed.MacOSX
else
other-modules: Codec.Text.IConv.Typed.Unix
test-suite iconv-typed-test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
build-depends: base
, iconv-typed
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010
source-repository head
type: git
location: https://github.com/adinapoli/iconv-typed