Skip to content

Commit

Permalink
Testing cabal project with Random library
Browse files Browse the repository at this point in the history
  • Loading branch information
Anastasios Valtinos committed Oct 7, 2022
1 parent 4f048c9 commit a5a6f97
Show file tree
Hide file tree
Showing 20 changed files with 261 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Haskell Excercises & Code/Chapter23 - State/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Revision history for Chapter23-State

## 0.1.0.0 -- YYYY-mm-dd

* First version. Released on an unsuspecting world.
36 changes: 36 additions & 0 deletions Haskell Excercises & Code/Chapter23 - State/Chapter23-State.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cabal-version: 2.4
name: Chapter23-State
version: 0.1.0.0

-- A short (one-line) description of the package.
-- synopsis:

-- A longer description of the package.
-- description:

-- A URL where users can report bugs.
-- bug-reports:

-- The license under which the package is released.
-- license:
author: Anastasios Valtinos
maintainer: anastasios.valtinos@trint.com

-- A copyright notice.
-- copyright:
-- category:
extra-source-files: CHANGELOG.md

executable testingState
main-is: StateTest.hs

-- Modules included in this executable, other than Main.
-- other-modules:

-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends: base ^>=4.16.0.0,
hspec,
random
hs-source-dirs: app
default-language: Haskell2010
4 changes: 4 additions & 0 deletions Haskell Excercises & Code/Chapter23 - State/app/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Main where

main :: IO ()
main = putStrLn "Hello, Haskell!"
11 changes: 11 additions & 0 deletions Haskell Excercises & Code/Chapter23 - State/app/StateTest.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module StateTest where
import System.Random
-- Six-sided die
data Die =
DieOne
| DieTwo
| DieThree
| DieFour
| DieFive
| DieSix
deriving (Eq, Show)
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -w #-}
module Paths_Chapter23_State (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where


import qualified Control.Exception as Exception
import qualified Data.List as List
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude


#if defined(VERSION_base)

#if MIN_VERSION_base(4,0,0)
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#else
catchIO :: IO a -> (Exception.Exception -> IO a) -> IO a
#endif

#else
catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
#endif
catchIO = Exception.catch

version :: Version
version = Version [0,1,0,0] []

getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir `joinFileName` name)

getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath



bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\bin"
libdir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\x86_64-windows-ghc-9.2.1\\Chapter23-State-0.1.0.0-inplace-testingState"
dynlibdir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\x86_64-windows-ghc-9.2.1"
datadir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\x86_64-windows-ghc-9.2.1\\Chapter23-State-0.1.0.0"
libexecdir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\Chapter23-State-0.1.0.0-inplace-testingState\\x86_64-windows-ghc-9.2.1\\Chapter23-State-0.1.0.0"
sysconfdir = "C:\\Users\\Administrator\\AppData\\Roaming\\cabal\\etc"

getBinDir = catchIO (getEnv "Chapter23_State_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "Chapter23_State_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "Chapter23_State_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "Chapter23_State_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "Chapter23_State_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "Chapter23_State_sysconfdir") (\_ -> return sysconfdir)




joinFileName :: String -> String -> FilePath
joinFileName "" fname = fname
joinFileName "." fname = fname
joinFileName dir "" = dir
joinFileName dir fname
| isPathSeparator (List.last dir) = dir ++ fname
| otherwise = dir ++ pathSeparator : fname

pathSeparator :: Char
pathSeparator = '\\'

isPathSeparator :: Char -> Bool
isPathSeparator c = c == '/' || c == '\\'
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */

/* package Chapter23-State-0.1.0.0 */
#ifndef VERSION_Chapter23_State
#define VERSION_Chapter23_State "0.1.0.0"
#endif /* VERSION_Chapter23_State */
#ifndef MIN_VERSION_Chapter23_State
#define MIN_VERSION_Chapter23_State(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 1 || \
(major1) == 0 && (major2) == 1 && (minor) <= 0)
#endif /* MIN_VERSION_Chapter23_State */
/* package base-4.16.0.0 */
#ifndef VERSION_base
#define VERSION_base "4.16.0.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 16 || \
(major1) == 4 && (major2) == 16 && (minor) <= 0)
#endif /* MIN_VERSION_base */
/* package hspec-2.9.2 */
#ifndef VERSION_hspec
#define VERSION_hspec "2.9.2"
#endif /* VERSION_hspec */
#ifndef MIN_VERSION_hspec
#define MIN_VERSION_hspec(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 9 || \
(major1) == 2 && (major2) == 9 && (minor) <= 2)
#endif /* MIN_VERSION_hspec */
/* package random-1.2.1.1 */
#ifndef VERSION_random
#define VERSION_random "1.2.1.1"
#endif /* VERSION_random */
#ifndef MIN_VERSION_random
#define MIN_VERSION_random(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 2 || \
(major1) == 1 && (major2) == 2 && (minor) <= 1)
#endif /* MIN_VERSION_random */

/* tool gcc-10.2.0 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "10.2.0"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 10 || \
(major1) == 10 && (major2) < 2 || \
(major1) == 10 && (major2) == 2 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-9.2.1 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "9.2.1"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-9.2.1 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "9.2.1"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.26.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.26.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 26 || \
(major1) == 2 && (major2) == 26 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool hpc-0.68 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.68"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.8 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.8"
#endif /* TOOL_VERSION_hsc2hs */
#ifndef MIN_TOOL_VERSION_hsc2hs
#define MIN_TOOL_VERSION_hsc2hs(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 68 || \
(major1) == 0 && (major2) == 68 && (minor) <= 8)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool runghc-9.2.1 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "9.2.1"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 9 || \
(major1) == 9 && (major2) < 2 || \
(major1) == 9 && (major2) == 2 && (minor) <= 1)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.34 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.34"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 34 || \
(major1) == 2 && (major2) == 34 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */

#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "Chapter23-State-0.1.0.0-inplace-testingState"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "0.1.0.0"
#endif /* CURRENT_PACKAGE_VERSION */
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit a5a6f97

Please sign in to comment.