{-# LANGUAGE NoImplicitPrelude #-}
module Codec.QRCode
(
encode
, encodeAutomatic
, encodeText
, encodeBinary
, encodeKanji
, encodeAlphanumeric
, encodeNumeric
, module Codec.QRCode.Data.QRCodeOptions
, module Codec.QRCode.Data.ErrorLevel
, module Codec.QRCode.Data.Mask
, module Codec.QRCode.Data.TextEncoding
, module Codec.QRCode.Data.ToInput
, module Codec.QRCode.Data.QRImage
) where
import Codec.QRCode.Base
import Codec.QRCode.Code.Intermediate
import Codec.QRCode.Data.ErrorLevel
import Codec.QRCode.Data.Mask
import Codec.QRCode.Data.QRCodeOptions
import Codec.QRCode.Data.QRImage
import Codec.QRCode.Data.Result
import Codec.QRCode.Data.TextEncoding
import Codec.QRCode.Data.ToInput
import Codec.QRCode.Mode.Alphanumeric
import Codec.QRCode.Mode.Automatic
import Codec.QRCode.Mode.Byte
import Codec.QRCode.Mode.Kanji
import Codec.QRCode.Mode.Mixed
import Codec.QRCode.Mode.Numeric
encode :: ToText a => QRCodeOptions -> TextEncoding -> a -> Maybe QRImage
{-# INLINABLE encode #-}
encode opt te = getResult . (fromIntermediate <$>) . (toIntermediate opt =<<) . mixed te
encodeAutomatic :: ToText a => QRCodeOptions -> TextEncoding -> a -> Maybe QRImage
{-# INLINABLE encodeAutomatic #-}
encodeAutomatic opt te = getResult . (fromIntermediate <$>) . (toIntermediate opt =<<) . automatic te
encodeText :: ToText a => QRCodeOptions -> TextEncoding -> a -> Maybe QRImage
{-# INLINABLE encodeText #-}
encodeText opt te = getResult . (fromIntermediate <$>) . (toIntermediate opt =<<) . text te
encodeBinary :: ToBinary a => QRCodeOptions -> a -> Maybe QRImage
{-# INLINABLE encodeBinary #-}
encodeBinary opt = getResult . (fromIntermediate <$>) . toIntermediate opt . binary
encodeKanji :: ToText a => QRCodeOptions -> a -> Maybe QRImage
{-# INLINABLE encodeKanji #-}
encodeKanji opt = getResult . (fromIntermediate <$>) . (toIntermediate opt =<<) . kanji
encodeAlphanumeric :: ToText a => QRCodeOptions -> a -> Maybe QRImage
{-# INLINABLE encodeAlphanumeric #-}
encodeAlphanumeric opt = getResult . (fromIntermediate <$>) . (toIntermediate opt =<<) . alphanumeric
encodeNumeric :: ToNumeric a => QRCodeOptions -> a -> Maybe QRImage
{-# INLINABLE encodeNumeric #-}
encodeNumeric opt = getResult . (fromIntermediate <$>) . (toIntermediate opt =<<) . numeric