packages feed

uniform-strings 0.1.0 → 0.1.2

raw patch · 5 files changed

+44/−42 lines, 5 filesdep −snap-coredep ~basedep ~uniform-algebras

Dependencies removed: snap-core

Dependency ranges changed: base, uniform-algebras

Files

ChangeLog.md view
@@ -3,3 +3,5 @@ 0.0.9 radical reduction to use Text only 0.0.11 structure regularized             added LanguageCodes, needs uniform-algebras+0.1.2 for 9.2.1 +    removed snap-core, because limited with attoparsec <0.14
README.md view
@@ -4,7 +4,7 @@  Tries to resolve the confusing breadth of choices to represent and operate on text in Haskell. It contains  -- a /principled/ set of conversions between representations for text, namely +- a *principled* set of conversions between representations for text, namely       - s - Strings, @@ -14,13 +14,13 @@      - l - LazyByteString,  -    - bu - ByteString containing UTF-8 characters,+    - bu - ByteString containing `UTF-8` characters, -    - latin - charcters with latin1 encoding+    - latin - charcters with `latin1` encoding      - u - URLencoding, and  -conversions functions of type `x2y` (e.g. `s2t` for a conversion from String to Text) and methods to circumvent the difficulties.+    conversions functions of *x to y* are named `x2y` (e.g. `s2t` for a conversion from String to Text).  - a set of functions applicable to character strings, which have the exact same semantics for all the types (usually the name of the function applicable to Strings with an appended \"\'\" to avoid name clashes with existing code. @@ -32,8 +32,8 @@ To Do: The code originated in 2010 to 2018. It will be revised  and the dependencies greatly reduced when using `text` and `basement`. -# Intention of "uniform" packages-The "uniform" packages are yet another attempt to select a useful subset from the overwhelming variety of the Haskell biotop. It was started in the 2010, grew over the years but was never packaged and put into Hackage; it is comparable to other similar attempts from which it has learned and occasionally copied code. +# Intention of *uniform* packages+The *uniform* packages are yet another attempt to select a useful subset from the overwhelming variety of the Haskell biotop. It was started in the 2010, grew over the years but was never packaged and put into Hackage; it is comparable to other similar attempts from which it has learned and occasionally copied code.   The "uniform" approach is different from some others by: - compatible with 'standard' Haskell, i.e. Haskell 2010 plus extensions as indicated in the modules,@@ -44,7 +44,7 @@  Choices are: - strong preference for total functions, achieved often with producing error messages which makes debugging easier than the plain failure of partial functions,-- use monads-tf because TypeFamilies seemed to lead to better documentation.+- use `monads-tf` because TypeFamilies seemed to lead to better documentation. -Issues with this approach: it is limited by the deeps of understanding of Haskell of the authors and his experience. It shows a focus on understanding semantics (and formal ontology) linked to algebra applied to practical problems (Geographic Information Systems). +Issues with this approach: it is limited by the deeps of understanding of Haskell of the author and his experience. It shows a focus on understanding semantics (and formal ontology) linked to algebra applied to practical problems (Geographic Information Systems).  It seems that efforts to construct coherent subsets of Haskell are limited by the complexity of the task -- the more comprehensive an environment should be the more complex is it to learn and use. The approach here is what emerged after some 25 years of using Haskell to write application oriented code, mostly to demonstrate theories in spatial information theory. 
Uniform/Strings/Conversion.hs view
@@ -34,17 +34,18 @@     , t2tl, tl2t     -- uses UTF8 as encoding in ByteString     -- urlencode is always represented the same as the input-    , Text (..), BSUTF (..), URL (..), URLform+    , Text (..), BSUTF (..), URL (..)+    -- , URLform , b2uf, b2urlf, urlf2b,      , b2bu, bu2b, bu2s, bu2t, t2bu, s2bu-    , u2b, u2t, b2uf, u2s, b2u+    , u2b, u2t,  u2s, b2u     , b2bl, bl2b -- lazy bytestring     , bl2t, t2bl     , bb2t, bb2s  -- conversion with error if not UTF8     , s2latin, t2latin, latin2t, latin2s -- conversion to the latin1 encoding     , BSlat (..), s2lat, lat2s, t2lat, lat2t     , s3lat, t3lat, s3latin, t3latin-    , s2url, url2s, b2urlf, urlf2b, unURL, t22latin+    , s2url, url2s,  unURL, t22latin     , convertLatin, findNonLatinChars, findNonLatinCharsT     , filterLatin     , module Safe@@ -68,7 +69,7 @@ import           Data.Text.Encoding   (decodeUtf8, decodeUtf8', encodeUtf8)  import qualified Network.URI          as URI-import qualified Snap.Core            as SN+-- import qualified Snap.Core            as SN  import qualified Data.Text.Lazy as LText  -- (toStrict, fromStrict) @@ -206,38 +207,38 @@   -- case for encoding of form content (with + for space)--newtype URLform = URLform ByteString deriving (Show, Eq)-unURLform :: URLform -> ByteString-unURLform (URLform t) = t+-- removed for 9.2.1 +-- newtype URLform = URLform ByteString deriving (Show, Eq)+-- unURLform :: URLform -> ByteString+-- unURLform (URLform t) = t  -b2urlf :: ByteString -> URLform--- ^ convert string to url   (uses code from SNAP, which converts space into +)-b2urlf =   URLform . SN.urlEncode+-- b2urlf :: ByteString -> URLform+-- -- ^ convert string to url   (uses code from SNAP, which converts space into +)+-- b2urlf =   URLform . SN.urlEncode -urlf2b :: URLform -> ByteString--- ^ convert url to string   (uses code from SNAP, which converts space into +)-urlf2b = fromJustNote "urlf2b nothing" . SN.urlDecode . unURLform+-- urlf2b :: URLform -> ByteString+-- -- ^ convert url to string   (uses code from SNAP, which converts space into +)+-- urlf2b = fromJustNote "urlf2b nothing" . SN.urlDecode . unURLform  -testUrlEncodingSNAP :: ByteString -> Bool-testUrlEncodingSNAP a =  maybe False ((a ==). SN.urlEncode) . SN.urlDecode $ a+-- testUrlEncodingSNAP :: ByteString -> Bool+-- testUrlEncodingSNAP a =  maybe False ((a ==). SN.urlEncode) . SN.urlDecode $ a  -urlf2u :: URLform -> ByteString-urlf2u = unURLform-u2urlf :: ByteString -> Maybe URLform-u2urlf a = if testUrlEncodingSNAP a then Just (URLform a) else Nothing--- this test allows control in url encoded strings ...+-- urlf2u :: URLform -> ByteString+-- urlf2u = unURLform+-- u2urlf :: ByteString -> Maybe URLform+-- u2urlf a = if testUrlEncodingSNAP a then Just (URLform a) else Nothing+-- -- this test allows control in url encoded strings ...  -b2uf :: ByteString -> ByteString--- ^ convert ByteString to url   (uses code from SNAP which converts space into +)-b2uf = urlf2u . b2urlf+-- b2uf :: ByteString -> ByteString+-- -- ^ convert ByteString to url   (uses code from SNAP which converts space into +)+-- b2uf = urlf2u . b2urlf -uf2b :: ByteString -> Maybe ByteString     --not inverse--- ^ convert url to ByteString   (uses code from SNAP, which converts space into +)-uf2b  =   fmap urlf2b . u2urlf+-- uf2b :: ByteString -> Maybe ByteString     --not inverse+-- -- ^ convert url to ByteString   (uses code from SNAP, which converts space into +)+-- uf2b  =   fmap urlf2b . u2urlf   t2u :: Text -> Text
Uniform/Strings/Utilities.hs view
@@ -431,7 +431,7 @@     showlong = shownice  -- a default class Show a => PrettyStrings a where      showPretty :: a -> Text-instance Show a => PrettyStrings a where+instance  {-# OVERLAPPABLE #-} Show a => PrettyStrings a where     showPretty = s2t . ppShow  instance NiceStrings Text where
uniform-strings.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.34.2.+-- This file has been generated from package.yaml by hpack version 0.34.6. -- -- see: https://github.com/sol/hpack  name:           uniform-strings-version:        0.1.0+version:        0.1.2 synopsis:       Manipulate and convert strings of characters uniformly and consistently description:    Reduce complexity of Haskell by providing a                  .@@ -46,19 +46,18 @@   other-modules:       Paths_uniform_strings   hs-source-dirs:-      ./.+      ./   build-depends:       MissingH-    , base >=4.7 && <5+    , base >4.5 && <5     , bytestring     , monads-tf     , network-uri     , pretty-show     , safe-    , snap-core     , split     , text     , text-icu-    , uniform-algebras+    , uniform-algebras >=0.1.2   default-language: Haskell2010   autogen-modules: Paths_uniform_strings