packages feed

funnyprint (empty) → 0.0.1

raw patch · 10 files changed

+309/−0 lines, 10 filesdep +basedep +criteriondep +funnyprintsetup-changed

Dependencies added: base, criterion, funnyprint, hscolour, ipprint, tasty, tasty-hspec

Files

+ CHANGELOG.md view
@@ -0,0 +1,7 @@+# Change log++funnyprint uses [Semantic Versioning][].+The change log is available through the [releases on GitHub][].++[Semantic Versioning]: http://semver.org/spec/v2.0.0.html+[releases on GitHub]: https://github.com/Pitometsu/funnyprint/releases
+ LICENSE.md view
@@ -0,0 +1,23 @@+[The MIT License (MIT)][]++Copyright (c) 2016 Yuriy Pitomets++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.++[The MIT License (MIT)]: https://opensource.org/licenses/MIT
+ README.md view
@@ -0,0 +1,15 @@+# [funnyprint][]++funnyPrint function to colorize GHCi output.++***++see `FunnyPrint.funnyPrint`.++Use it as `:set -interactive-print=funnyPrint`.++- XTerm colors+- UTF8 output+- Simple indentation++[funnyprint]: https://github.com/Pitometsu/funnyprint
+ Setup.hs view
@@ -0,0 +1,7 @@+-- This script is used to build and install your package. Typically you don't+-- need to change it. The Cabal documentation has more information about this+-- file: <https://www.haskell.org/cabal/users-guide/installing-packages.html>.+import qualified Distribution.Simple++main :: IO ()+main = Distribution.Simple.defaultMain
+ benchmark/Main.hs view
@@ -0,0 +1,6 @@+-- You can benchmark your code quickly and effectively with Criterion. See its+-- website for help: <http://www.serpentine.com/criterion/>.+import Criterion.Main++main :: IO ()+main = defaultMain [bench "const" (whnf const ())]
+ funnyprint.cabal view
@@ -0,0 +1,67 @@+-- This file has been generated from package.yaml by hpack version 0.13.0.+--+-- see: https://github.com/sol/hpack++name:           funnyprint+version:        0.0.1+synopsis:       funnyPrint function to colorize GHCi output.+description:    see FunnyPrint.funnyPrint.+category:       Text+homepage:       https://github.com/Pitometsu/funnyprint#readme+bug-reports:    https://github.com/Pitometsu/funnyprint/issues+maintainer:     Yuriy Pitomets+license:        MIT+build-type:     Simple+cabal-version:  >= 1.10++extra-source-files:+    CHANGELOG.md+    LICENSE.md+    package.yaml+    README.md+    stack.yaml++source-repository head+  type: git+  location: https://github.com/Pitometsu/funnyprint++library+  hs-source-dirs:+      library+  ghc-options: -Wall+  build-depends:+      base >= 2 && < 6+    , hscolour+    , ipprint == 0.6+  exposed-modules:+      FunnyPrint+  default-language: Haskell2010++test-suite funnyprint-test-suite+  type: exitcode-stdio-1.0+  main-is: Main.hs+  hs-source-dirs:+      test-suite+  ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N+  build-depends:+      base >= 2 && < 6+    , hscolour+    , ipprint == 0.6+    , funnyprint+    , tasty+    , tasty-hspec+  default-language: Haskell2010++benchmark funnyprint-benchmarks+  type: exitcode-stdio-1.0+  main-is: Main.hs+  hs-source-dirs:+      benchmark+  ghc-options: -Wall -rtsopts -threaded -with-rtsopts=-N+  build-depends:+      base >= 2 && < 6+    , hscolour+    , ipprint == 0.6+    , funnyprint+    , criterion+  default-language: Haskell2010
+ library/FunnyPrint.hs view
@@ -0,0 +1,46 @@+-- | funnyPrint function to colorize GHCi output. See @FunnyPrint.funnyPrint@.+module FunnyPrint ( funnyPrint ) where++import IPPrint ( pshow )+import Language.Haskell.HsColour.Output ( TerminalType(..) )+import Language.Haskell.HsColour.Colourise ( Colour(..)+                                           , Highlight(..)+                                           , defaultColourPrefs+                                           )+import Language.Haskell.HsColour ( ColourPrefs(..)+                                 , Output(TTYg)+                                 , hscolour+                                 )++-- | Colorize GHCi. UTF8 support. Smart indentatntion. Use as @:set -interactive-print=funnyPrint@.+funnyPrint :: (Show a) => a -> IO ()+funnyPrint = putStrLn . colorize . con . pshow+  where+    con :: String -> String+    con [] = []+    con li@(x:xs) | x == '\"' = '\"':str ++ "\"" ++ (con rest)+                  | x == '\'' = '\'':chr:'\'':(con rest')+                  | otherwise = x:con xs+      where+        (str, rest):_  = reads li :: [(String, String)]+        (chr, rest'):_ = reads li :: [(Char,   String)]+    prefs = TTYg XTerm256Compatible+    colorize = hscolour prefs colours False False "" False+    colours = defaultColourPrefs { conid    = [ yellow , bold ]+                                 , conop    = [ yellow ]+                                 , string   = [ green ]+                                 , char     = [ cyan ]+                                 , number   = [ red , bold ]+                                 , layout   = [ black ]+                                 , keyglyph = [ black ]+                                 }+      where+        black   = Foreground Black+        red     = Foreground Red+        green   = Foreground Green+        yellow  = Foreground Yellow+        -- blue    = Foreground Blue+        magenta = Foreground Magenta+        cyan    = Foreground Cyan+        -- white   = Foreground White+        bold    = Bold
+ package.yaml view
@@ -0,0 +1,53 @@+# This YAML file describes your package. Stack will automatically generate a+# Cabal file when you run `stack build`. See the hpack website for help with+# this file: <https://github.com/sol/hpack>.+benchmarks:+  funnyprint-benchmarks:+    dependencies:+    - base >= 2 && < 6+    - hscolour+    - ipprint == 0.6+    - funnyprint+    - criterion+    ghc-options:+    - -rtsopts+    - -threaded+    - -with-rtsopts=-N+    main: Main.hs+    source-dirs: benchmark+category: Text+description: see FunnyPrint.funnyPrint.+extra-source-files:+- CHANGELOG.md+- LICENSE.md+- package.yaml+- README.md+- stack.yaml+ghc-options: -Wall+github: Pitometsu/funnyprint+library:+  dependencies:+  - base >= 2 && < 6+  - hscolour+  - ipprint == 0.6+  source-dirs: library+license: MIT+maintainer: Yuriy Pitomets+name: funnyprint+synopsis: funnyPrint function to colorize GHCi output.+tests:+  funnyprint-test-suite:+    dependencies:+    - base >= 2 && < 6+    - hscolour+    - ipprint == 0.6+    - funnyprint+    - tasty+    - tasty-hspec+    ghc-options:+    - -rtsopts+    - -threaded+    - -with-rtsopts=-N+    main: Main.hs+    source-dirs: test-suite+version: '0.0.1'
+ stack.yaml view
@@ -0,0 +1,68 @@+# This file was automatically generated by 'stack init'+# +# Some commonly used options have been documented as comments in this file.+# For advanced use and comprehensive documentation of the format, please see:+# http://docs.haskellstack.org/en/stable/yaml_configuration/++# Resolver to choose a 'specific' stackage snapshot or a compiler version.+# A snapshot resolver dictates the compiler version and the set of packages+# to be used for project dependencies. For example:+# +# resolver: lts-3.5+# resolver: nightly-2015-09-21+# resolver: ghc-7.10.2+# resolver: ghcjs-0.1.0_ghc-7.10.2+# resolver:+#  name: custom-snapshot+#  location: "./custom-snapshot.yaml"+resolver: lts-6.1++# User packages to be built.+# Various formats can be used as shown in the example below.+# +# packages:+# - some-directory+# - https://example.com/foo/bar/baz-0.0.2.tar.gz+# - location:+#    git: https://github.com/commercialhaskell/stack.git+#    commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a+# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a+#   extra-dep: true+#  subdirs:+#  - auto-update+#  - wai+# +# A package marked 'extra-dep: true' will only be built if demanded by a+# non-dependency (i.e. a user package), and its test suites and benchmarks+# will not be run. This is useful for tweaking upstream packages.+packages:+- '.'+# Dependency packages to be pulled from upstream that are not in the resolver+# (e.g., acme-missiles-0.3)+extra-deps:+  - ipprint-0.6+  - sr-extra-1.46.3.2++# Override default flag values for local packages and extra-deps+flags: {}++# Extra package databases containing global packages+extra-package-dbs: []++# Control whether we use the GHC we find on the path+# system-ghc: true+# +# Require a specific version of stack, using version ranges+# require-stack-version: -any # Default+# require-stack-version: ">=1.1"+# +# Override the architecture used by stack, especially useful on Windows+# arch: i386+# arch: x86_64+# +# Extra directories used by stack for building+# extra-include-dirs: [/path/to/dir]+# extra-lib-dirs: [/path/to/dir]+# +# Allow a newer minor version of GHC than the snapshot specifies+# compiler-check: newer-minor
+ test-suite/Main.hs view
@@ -0,0 +1,17 @@+-- Tasty makes it easy to test your code. It is a test framework that can+-- combine many different types of tests into one suite. See its website for+-- help: <http://documentup.com/feuerbach/tasty>.+import qualified Test.Tasty+-- Hspec is one of the providers for Tasty. It provides a nice syntax for+-- writing tests. Its website has more info: <https://hspec.github.io>.+import Test.Tasty.Hspec++main :: IO ()+main = do+    test <- testSpec "funnyprint" spec+    Test.Tasty.defaultMain test++spec :: Spec+spec = parallel $ do+    it "is trivially true" $ do+        True `shouldBe` True