fix(stack): use stack build and exec instead of manual stack ghc

refactor: rename from Lib to Sibe
This commit is contained in:
Mahdi Dibaiee 2016-07-18 16:33:34 +04:30
parent 4397f5203a
commit 23851a85f5
11 changed files with 39 additions and 63 deletions

35
LICENSE
View File

@ -1,35 +1,3 @@
<<<<<<< HEAD
Copyright Author name here (c) 2016
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Author name here nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=======
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
@ -684,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode: notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname} Sibe Copyright (C) 2016 Mahdi Dibaiee
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.
@ -704,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>. <http://www.gnu.org/philosophy/why-not-lgpl.html>.
>>>>>>> ba301efb2909d359ae56cc0bce3710ccf10b139f

BIN
app/Main

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
module Main where module Main where
import Lib import Sibe
import Numeric.LinearAlgebra import Numeric.LinearAlgebra
import Data.List import Data.List
import Debug.Trace import Debug.Trace

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
module Main where module Main where
import Lib import Sibe
import Numeric.LinearAlgebra import Numeric.LinearAlgebra
import Data.List import Data.List
import Debug.Trace import Debug.Trace
@ -21,12 +21,11 @@ module Main where
updated_network = session inputs network labels learning_rate (iterations, epochs) updated_network = session inputs network labels learning_rate (iterations, epochs)
results = map (`forward` updated_network) inputs results = map (`forward` updated_network) inputs
rounded = map (map round) $ map toList results rounded = map (map round . toList) results
in sequence [putStrLn "", in sequence [putStrLn $ "inputs: " ++ show inputs,
putStrLn $ "inputs: " ++ show inputs,
putStrLn $ "labels: " ++ show labels, putStrLn $ "labels: " ++ show labels,
putStrLn $ "learning rate: " ++ show learning_rate, putStrLn $ "learning rate: " ++ show learning_rate,
putStrLn $ "iterations/epochs: " ++ show (iterations, epochs), putStrLn $ "iterations/epochs: " ++ show (iterations, epochs),
putStrLn $ "...", putStrLn "...",
putStrLn $ "rounded result: " ++ show rounded, putStrLn $ "rounded result: " ++ show rounded,
putStrLn $ "actual result: " ++ show results] putStrLn $ "actual result: " ++ show results]

View File

@ -1,22 +1,24 @@
name: sibe name: sibe
version: 0.1.0.0 version: 0.1.0.0
synopsis: Initial project template from stack synopsis: Initial project template from stack
description: Please see README.md description: Haskell Machine Learning
homepage: https://github.com/githubuser/sibe#readme homepage: https://github.com/mdibaiee/sibe
license: BSD3 license: GPL-3
license-file: LICENSE license-file: LICENSE
author: Author name here author: Mahdi Dibaiee
maintainer: example@example.com maintainer: mdibaiee@aol.com
copyright: 2016 Author name here copyright: 2016 Mahdi Dibaiee
category: Web category: Web, Machine Learning, Data Science
build-type: Simple build-type: Simple
-- extra-source-files: -- extra-source-files:
cabal-version: >=1.10 cabal-version: >=1.10
library library
hs-source-dirs: src hs-source-dirs: src
exposed-modules: Lib exposed-modules: Sibe
build-depends: base >= 4.7 && < 5 build-depends: base >= 4.7 && < 5
, hmatrix
, random
default-language: Haskell2010 default-language: Haskell2010
executable sibe-exe executable sibe-exe
@ -25,6 +27,7 @@ executable sibe-exe
ghc-options: -threaded -rtsopts -with-rtsopts=-N ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base build-depends: base
, sibe , sibe
, hmatrix
default-language: Haskell2010 default-language: Haskell2010
executable example-xor executable example-xor
@ -33,6 +36,7 @@ executable example-xor
ghc-options: -threaded -rtsopts -with-rtsopts=-N ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base build-depends: base
, sibe , sibe
, hmatrix
default-language: Haskell2010 default-language: Haskell2010
test-suite sibe-test test-suite sibe-test
@ -41,9 +45,10 @@ test-suite sibe-test
main-is: Spec.hs main-is: Spec.hs
build-depends: base build-depends: base
, sibe , sibe
, hmatrix
ghc-options: -threaded -rtsopts -with-rtsopts=-N ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010 default-language: Haskell2010
source-repository head source-repository head
type: git type: git
location: https://github.com/githubuser/sibe location: https://github.com/mdibaiee/sibe

View File

@ -3,7 +3,7 @@
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeOperators #-}
module Lib module Sibe
(Network(..), (Network(..),
Layer, Layer,
Input, Input,
@ -15,7 +15,6 @@ module Lib
shuffle, shuffle,
) where ) where
import Numeric.LinearAlgebra import Numeric.LinearAlgebra
import Control.Monad.Random
import System.Random import System.Random
import Debug.Trace import Debug.Trace
import Data.List (foldl', sortBy) import Data.List (foldl', sortBy)

View File

@ -1,5 +1,5 @@
# This file was automatically generated by 'stack init' # This file was automatically generated by 'stack init'
# #
# Some commonly used options have been documented as comments in this file. # Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see: # For advanced use and comprehensive documentation of the format, please see:
# http://docs.haskellstack.org/en/stable/yaml_configuration/ # http://docs.haskellstack.org/en/stable/yaml_configuration/
@ -7,7 +7,7 @@
# Resolver to choose a 'specific' stackage snapshot or a compiler version. # Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages # A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example: # to be used for project dependencies. For example:
# #
# resolver: lts-3.5 # resolver: lts-3.5
# resolver: nightly-2015-09-21 # resolver: nightly-2015-09-21
# resolver: ghc-7.10.2 # resolver: ghc-7.10.2
@ -19,7 +19,7 @@ resolver: lts-6.7
# User packages to be built. # User packages to be built.
# Various formats can be used as shown in the example below. # Various formats can be used as shown in the example below.
# #
# packages: # packages:
# - some-directory # - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz # - https://example.com/foo/bar/baz-0.0.2.tar.gz
@ -31,7 +31,7 @@ resolver: lts-6.7
# subdirs: # subdirs:
# - auto-update # - auto-update
# - wai # - wai
# #
# A package marked 'extra-dep: true' will only be built if demanded by a # 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 # non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages. # will not be run. This is useful for tweaking upstream packages.
@ -39,9 +39,9 @@ packages:
- location: - location:
git: git@github.com:albertoruiz/hmatrix.git git: git@github.com:albertoruiz/hmatrix.git
commit: 42a88fbcb6bd1d2c4dc18fae5e962bd34fb316a1 commit: 42a88fbcb6bd1d2c4dc18fae5e962bd34fb316a1
subdirs: subdirs:
- packages/base - packages/base
#- '.' - '.'
# Dependency packages to be pulled from upstream that are not in the resolver # Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3) # (e.g., acme-missiles-0.3)
@ -55,18 +55,18 @@ extra-package-dbs: []
# Control whether we use the GHC we find on the path # Control whether we use the GHC we find on the path
# system-ghc: true # system-ghc: true
# #
# Require a specific version of stack, using version ranges # Require a specific version of stack, using version ranges
# require-stack-version: -any # Default # require-stack-version: -any # Default
# require-stack-version: ">=1.1" # require-stack-version: ">=1.1"
# #
# Override the architecture used by stack, especially useful on Windows # Override the architecture used by stack, especially useful on Windows
# arch: i386 # arch: i386
# arch: x86_64 # arch: x86_64
# #
# Extra directories used by stack for building # Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir] # extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir] # extra-lib-dirs: [/path/to/dir]
# #
# Allow a newer minor version of GHC than the snapshot specifies # Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor # compiler-check: newer-minor

View File

@ -1,2 +1,8 @@
main :: IO () module Main where
main = putStrLn "Test suite not yet implemented" import System.Exit (exitFailure)
import Sibe
main = do
putStrLn "Hey"
exitFailure