git.iko.soy/typeable/minio-hs
on master help sign in
Initial commit
commitd7ceaf272e3c2af078b07d43c646a7806a21f445 authorAditya Manthramurthy <aditya.mmy@gmail.com> dateMon 5 Sep 2016, 14:18 (10 years ago) parenta1b4669
7 files changed+197
Setup.hs+2 app/Main.hs+7 minio-client.cabal+52 src/Lib.hs+55 src/Lib/Prelude.hs+11 stack.yaml+66 test/Spec.hs+4
Setup.hsnew file+2
@@ -0,0 +1,2 @@
1+import Distribution.Simple
2+main = defaultMain
app/Main.hsnew file+7
@@ -0,0 +1,7 @@
1+module Main where
2+
3+import Protolude
4+import Lib
5+
6+main :: IO ()
7+main = someFunc
minio-client.cabalnew file+52
@@ -0,0 +1,52 @@
1+name: minio-client
2+version: 0.1.0.0
3+synopsis: Initial project template from stack
4+description: Please see README.md
5+homepage: https://github.com/donatello/minio-client#readme
6+license: BSD3
7+license-file: LICENSE
8+author: Aditya Manthramurthy
9+maintainer: aditya.mmy@gmail.com
10+copyright: GPLv3
11+category: Network, AWS, Object Storage
12+build-type: Simple
13+-- extra-source-files:
14+cabal-version: >=1.10
15+
16+library
17+ hs-source-dirs: src
18+ ghc-options: -Wall
19+ exposed-modules: Lib
20+ other-modules: Lib.Prelude
21+ build-depends: base >= 4.7 && < 5
22+ , protolude >= 0.1.6 && < 0.2
23+ , bytestring
24+ , cryptonite
25+ , text
26+ default-language: Haskell2010
27+ default-extensions: OverloadedStrings, NoImplicitPrelude
28+
29+executable minio-client-exe
30+ hs-source-dirs: app
31+ main-is: Main.hs
32+ ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
33+ build-depends: base
34+ , minio-client
35+ , protolude >= 0.1.6 && < 0.2
36+ default-language: Haskell2010
37+ default-extensions: OverloadedStrings, NoImplicitPrelude
38+
39+test-suite minio-client-test
40+ type: exitcode-stdio-1.0
41+ hs-source-dirs: test
42+ main-is: Spec.hs
43+ build-depends: base
44+ , minio-client
45+ , protolude >= 0.1.6 && < 0.2
46+ ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
47+ default-language: Haskell2010
48+ default-extensions: OverloadedStrings, NoImplicitPrelude
49+
50+source-repository head
51+ type: git
52+ location: https://github.com/donatello/minio-client
src/Lib.hsnew file+55
@@ -0,0 +1,55 @@
1+{-|
2+Module : Lib
3+Description : Lib's main module
4+
5+This is a haddock comment describing your library
6+For more information on how to write Haddock comments check the user guide:
7+<https://www.haskell.org/haddock/doc/html/index.html>
8+-}
9+module Lib
10+ ( someFunc
11+ , hmacSha256
12+ , sha256Hash
13+ ) where
14+
15+import Lib.Prelude
16+
17+import Crypto.Hash (SHA256, Digest, hash)
18+import Crypto.MAC.HMAC (hmac, HMAC(hmacGetDigest))
19+
20+-- | Prints someFunc
21+--
22+-- >>> someFunc 10
23+-- someFunc
24+someFunc :: IO ()
25+someFunc = putStrLn ("someFunc" :: Text)
26+
27+hmacSha256 :: ByteString -> ByteString -> ByteString
28+hmacSha256 key message =
29+ show (hmacGetDigest (hmac key message) :: Digest SHA256)
30+
31+sha256Hash :: ByteString -> ByteString
32+sha256Hash payload = show (hash payload :: Digest SHA256)
33+
34+{-
35+
36+
37+public static String UriEncode(CharSequence input, boolean encodeSlash) {
38+ StringBuilder result = new StringBuilder();
39+ for (int i = 0; i < input.length(); i++) {
40+ char ch = input.charAt(i);
41+ if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') ||
42+ (ch >= '0' && ch <= '9') || ch == '_' || ch == '-' || ch == '~' || ch == '.') {
43+ result.append(ch);
44+ } else if (ch == '/') {
45+ result.append(encodeSlash ? "%2F" : ch);
46+ } else {
47+ result.append(toHexUTF8(ch));
48+ }
49+ }
50+ return result.toString();
51+ }
52+ch 65536 -> %10000
53+-}
54+uriEncode :: Text -> Bool -> ByteString
55+uriEncode payload encodeSlash =
src/Lib/Prelude.hsnew file+11
@@ -0,0 +1,11 @@
1+{-
2+Welcome to your custom Prelude
3+Export here everything that should always be in your library scope
4+For more info on what is exported by Protolude check:
5+https://github.com/sdiehl/protolude/blob/master/Symbols.md
6+-}
7+module Lib.Prelude
8+ ( module Exports
9+ ) where
10+
11+import Protolude as Exports
stack.yamlnew file+66
@@ -0,0 +1,66 @@
1+# This file was automatically generated by 'stack init'
2+#
3+# Some commonly used options have been documented as comments in this file.
4+# For advanced use and comprehensive documentation of the format, please see:
5+# http://docs.haskellstack.org/en/stable/yaml_configuration/
6+
7+# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+# A snapshot resolver dictates the compiler version and the set of packages
9+# to be used for project dependencies. For example:
10+#
11+# resolver: lts-3.5
12+# resolver: nightly-2015-09-21
13+# resolver: ghc-7.10.2
14+# resolver: ghcjs-0.1.0_ghc-7.10.2
15+# resolver:
16+# name: custom-snapshot
17+# location: "./custom-snapshot.yaml"
18+resolver: lts-6.15
19+
20+# User packages to be built.
21+# Various formats can be used as shown in the example below.
22+#
23+# packages:
24+# - some-directory
25+# - https://example.com/foo/bar/baz-0.0.2.tar.gz
26+# - location:
27+# git: https://github.com/commercialhaskell/stack.git
28+# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
29+# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
30+# extra-dep: true
31+# subdirs:
32+# - auto-update
33+# - wai
34+#
35+# A package marked 'extra-dep: true' will only be built if demanded by a
36+# non-dependency (i.e. a user package), and its test suites and benchmarks
37+# will not be run. This is useful for tweaking upstream packages.
38+packages:
39+- '.'
40+# Dependency packages to be pulled from upstream that are not in the resolver
41+# (e.g., acme-missiles-0.3)
42+extra-deps: []
43+
44+# Override default flag values for local packages and extra-deps
45+flags: {}
46+
47+# Extra package databases containing global packages
48+extra-package-dbs: []
49+
50+# Control whether we use the GHC we find on the path
51+# system-ghc: true
52+#
53+# Require a specific version of stack, using version ranges
54+# require-stack-version: -any # Default
55+# require-stack-version: ">=1.1"
56+#
57+# Override the architecture used by stack, especially useful on Windows
58+# arch: i386
59+# arch: x86_64
60+#
61+# Extra directories used by stack for building
62+# extra-include-dirs: [/path/to/dir]
63+# extra-lib-dirs: [/path/to/dir]
64+#
65+# Allow a newer minor version of GHC than the snapshot specifies
66+# compiler-check: newer-minor
test/Spec.hsnew file+4
@@ -0,0 +1,4 @@
1+import Protolude
2+
3+main :: IO ()
4+main = putStrLn ("Test suite not yet implemented" :: Text)