fmt (empty) → 0.0.0.1
raw patch · 5 files changed
+98/−0 lines, 5 filesdep +basedep +textdep +text-formatsetup-changed
Dependencies added: base, text, text-format
Files
- CHANGELOG.md +3/−0
- LICENSE +20/−0
- Setup.hs +2/−0
- fmt.cabal +32/−0
- lib/Fmt.hs +41/−0
+ CHANGELOG.md view
@@ -0,0 +1,3 @@+# 0.1.0.0++First release.
+ LICENSE view
@@ -0,0 +1,20 @@+Copyright (c) 2016 Artyom++Permission is hereby granted, free of charge, to any person obtaining+a copy of this software and associated documentation files (the+"Software"), to deal in the Software without restriction, including+without limitation the rights to use, copy, modify, merge, publish,+distribute, sublicense, and/or sell copies of the Software, and to+permit persons to whom the Software is furnished to do so, subject to+the following conditions:++The above copyright notice and this permission notice shall be included+in all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ fmt.cabal view
@@ -0,0 +1,32 @@+name: fmt+version: 0.0.0.1+synopsis: Nice formatting library+description:+ Nice formatting library+homepage: http://github.com/aelve/fmt+bug-reports: http://github.com/aelve/fmt/issues+license: MIT+license-file: LICENSE+author: Artyom+maintainer: yom@artyom.me+-- copyright: +category: Text+tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1+build-type: Simple+extra-source-files: CHANGELOG.md+cabal-version: >=1.10++source-repository head+ type: git+ location: git://github.com/aelve/fmt.git++library+ exposed-modules: Fmt+ -- other-modules: + -- other-extensions: + build-depends: base >=4.6 && <5,+ text,+ text-format >= 0.3+ ghc-options: -Wall -fno-warn-unused-do-bind+ hs-source-dirs: lib+ default-language: Haskell2010
+ lib/Fmt.hs view
@@ -0,0 +1,41 @@+{-# LANGUAGE FlexibleInstances #-}++module Fmt+(+ (%<),+ (>%),++ FromBuilder(..),+)+where++import Data.Text+import qualified Data.Text.Lazy as TL+import Data.Text.Lazy.Builder hiding (fromString)+import Data.Monoid+import Data.Text.Buildable++class FromBuilder a where+ fromBuilder :: Builder -> a++instance FromBuilder Builder where+ fromBuilder = id+ {-# INLINE fromBuilder #-}++instance FromBuilder String where+ fromBuilder = TL.unpack . toLazyText+ {-# INLINE fromBuilder #-}++instance FromBuilder Text where+ fromBuilder = TL.toStrict . toLazyText+ {-# INLINE fromBuilder #-}++instance FromBuilder TL.Text where+ fromBuilder = toLazyText+ {-# INLINE fromBuilder #-}++(%<) :: (Buildable a, FromBuilder b) => Builder -> a -> b+(%<) x a = fromBuilder (x <> build a)++(>%) :: (FromBuilder b) => Builder -> Builder -> b+(>%) x a = fromBuilder (x <> a)