Browse Source

Exercism: Leap

master
Julio Biason 3 years ago
parent
commit
b028400c5b
  1. 32
      haskell/leap/.exercism/config.json
  2. 1
      haskell/leap/.exercism/metadata.json
  3. 0
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build-lock
  4. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/LeapYear.dyn_hi
  5. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/LeapYear.dyn_o
  6. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/LeapYear.hi
  7. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/LeapYear.o
  8. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/Paths_leap.dyn_hi
  9. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/Paths_leap.dyn_o
  10. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/Paths_leap.hi
  11. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/Paths_leap.o
  12. 50
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/autogen/Paths_leap.hs
  13. 132
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/autogen/cabal_macros.h
  14. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/libHSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp-ghc8.8.4.so
  15. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/libHSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp.a
  16. 50
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/autogen/Paths_leap.hs
  17. 151
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/autogen/cabal_macros.h
  18. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test
  19. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test-tmp/Main.hi
  20. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test-tmp/Main.o
  21. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test-tmp/Paths_leap.hi
  22. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test-tmp/Paths_leap.o
  23. 26
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/package.conf.inplace/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp.conf
  24. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/package.conf.inplace/package.cache
  25. 0
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/package.conf.inplace/package.cache.lock
  26. BIN
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup-config
  27. 12
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/stack-build-caches/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/lib
  28. 12
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/stack-build-caches/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/test-test
  29. 1
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/stack-cabal-mod
  30. 1
      haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/stack-test-success
  31. BIN
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/LeapYear.dyn_hi
  32. BIN
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/LeapYear.hi
  33. BIN
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/Paths_leap.dyn_hi
  34. BIN
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/Paths_leap.hi
  35. BIN
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/libHSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp.a
  36. BIN
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/libHSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp-ghc8.8.4.so
  37. 28
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/pkgdb/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp.conf
  38. BIN
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/pkgdb/package.cache
  39. 0
      haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/pkgdb/package.cache.lock
  40. BIN
      haskell/leap/.stack-work/stack.sqlite3
  41. 0
      haskell/leap/.stack-work/stack.sqlite3.pantry-write-lock
  42. 88
      haskell/leap/HELP.md
  43. 56
      haskell/leap/README.md
  44. 16
      haskell/leap/examples/error-nosig/package.yaml
  45. 4
      haskell/leap/examples/error-nosig/src/LeapYear.hs
  46. 16
      haskell/leap/examples/success-standard/package.yaml
  47. 34
      haskell/leap/leap.cabal
  48. 21
      haskell/leap/package.yaml
  49. 7
      haskell/leap/src/LeapYear.hs
  50. 1
      haskell/leap/stack.yaml
  51. 12
      haskell/leap/stack.yaml.lock
  52. 66
      haskell/leap/test/Tests.hs

32
haskell/leap/.exercism/config.json

@ -0,0 +1,32 @@
{
"blurb": "Given a year, report if it is a leap year.",
"authors": [
"etrepum"
],
"contributors": [
"iHiD",
"karen-pal",
"kytrinyx",
"navossoc",
"paulrex",
"petertseng",
"ppartarr",
"rbasso",
"sshine",
"tejasbubane",
"tofische"
],
"files": {
"solution": [
"src/LeapYear.hs"
],
"test": [
"test/Tests.hs"
],
"example": [
"examples/success-standard/src/LeapYear.hs"
]
},
"source": "JavaRanch Cattle Drive, exercise 3",
"source_url": "http://www.javaranch.com/leap.jsp"
}

1
haskell/leap/.exercism/metadata.json

@ -0,0 +1 @@
{"track":"haskell","exercise":"leap","id":"94a6f31b1bcd4b52aa6eb98681d2859e","url":"https://exercism.org/tracks/haskell/exercises/leap","handle":"JBiason","is_requester":true,"auto_approve":false}

0
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build-lock vendored

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/LeapYear.dyn_hi vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/LeapYear.dyn_o vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/LeapYear.hi vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/LeapYear.o vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/Paths_leap.dyn_hi vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/Paths_leap.dyn_o vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/Paths_leap.hi vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/Paths_leap.o vendored

Binary file not shown.

50
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/autogen/Paths_leap.hs vendored

@ -0,0 +1,50 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
module Paths_leap (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Exception
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 [1,6,0,10] []
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/bin"
libdir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp"
dynlibdir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4"
datadir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/share/x86_64-linux-ghc-8.8.4/leap-1.6.0.10"
libexecdir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/libexec/x86_64-linux-ghc-8.8.4/leap-1.6.0.10"
sysconfdir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/etc"
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
getBinDir = catchIO (getEnv "leap_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "leap_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "leap_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "leap_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "leap_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "leap_sysconfdir") (\_ -> return sysconfdir)
getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir ++ "/" ++ name)

132
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/autogen/cabal_macros.h vendored

@ -0,0 +1,132 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package leap-1.6.0.10 */
#ifndef VERSION_leap
#define VERSION_leap "1.6.0.10"
#endif /* VERSION_leap */
#ifndef MIN_VERSION_leap
#define MIN_VERSION_leap(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 0)
#endif /* MIN_VERSION_leap */
/* package base-4.13.0.0 */
#ifndef VERSION_base
#define VERSION_base "4.13.0.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 13 || \
(major1) == 4 && (major2) == 13 && (minor) <= 0)
#endif /* MIN_VERSION_base */
/* tool gcc-11 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "11"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 11 || \
(major1) == 11 && (major2) < 0 || \
(major1) == 11 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-8.8.4 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "8.8.4"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 8 || \
(major1) == 8 && (major2) == 8 && (minor) <= 4)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-8.8.4 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "8.8.4"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 8 || \
(major1) == 8 && (major2) == 8 && (minor) <= 4)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.23.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.23.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 23 || \
(major1) == 2 && (major2) == 23 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool hpc-0.67 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.67"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 67 || \
(major1) == 0 && (major2) == 67 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.7 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.7"
#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) <= 7)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool pkg-config-1.7.3 */
#ifndef TOOL_VERSION_pkg_config
#define TOOL_VERSION_pkg_config "1.7.3"
#endif /* TOOL_VERSION_pkg_config */
#ifndef MIN_TOOL_VERSION_pkg_config
#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 7 || \
(major1) == 1 && (major2) == 7 && (minor) <= 3)
#endif /* MIN_TOOL_VERSION_pkg_config */
/* tool runghc-8.8.4 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "8.8.4"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 8 || \
(major1) == 8 && (major2) == 8 && (minor) <= 4)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.35 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.35"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 35 || \
(major1) == 2 && (major2) == 35 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_PACKAGE_KEY
#define CURRENT_PACKAGE_KEY "leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp"
#endif /* CURRENT_PACKAGE_KEY */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "1.6.0.10"
#endif /* CURRENT_PACKAGE_VERSION */

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/libHSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp-ghc8.8.4.so vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/libHSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp.a vendored

Binary file not shown.

50
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/autogen/Paths_leap.hs vendored

@ -0,0 +1,50 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
module Paths_leap (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Exception
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 [1,6,0,10] []
bindir, libdir, dynlibdir, datadir, libexecdir, sysconfdir :: FilePath
bindir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/bin"
libdir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-1OMYOoaCAf7BtVC4aNe49e-test"
dynlibdir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4"
datadir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/share/x86_64-linux-ghc-8.8.4/leap-1.6.0.10"
libexecdir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/libexec/x86_64-linux-ghc-8.8.4/leap-1.6.0.10"
sysconfdir = "/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/etc"
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, getSysconfDir :: IO FilePath
getBinDir = catchIO (getEnv "leap_bindir") (\_ -> return bindir)
getLibDir = catchIO (getEnv "leap_libdir") (\_ -> return libdir)
getDynLibDir = catchIO (getEnv "leap_dynlibdir") (\_ -> return dynlibdir)
getDataDir = catchIO (getEnv "leap_datadir") (\_ -> return datadir)
getLibexecDir = catchIO (getEnv "leap_libexecdir") (\_ -> return libexecdir)
getSysconfDir = catchIO (getEnv "leap_sysconfdir") (\_ -> return sysconfdir)
getDataFileName :: FilePath -> IO FilePath
getDataFileName name = do
dir <- getDataDir
return (dir ++ "/" ++ name)

151
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/autogen/cabal_macros.h vendored

@ -0,0 +1,151 @@
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package leap-1.6.0.10 */
#ifndef VERSION_leap
#define VERSION_leap "1.6.0.10"
#endif /* VERSION_leap */
#ifndef MIN_VERSION_leap
#define MIN_VERSION_leap(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 0)
#endif /* MIN_VERSION_leap */
/* package base-4.13.0.0 */
#ifndef VERSION_base
#define VERSION_base "4.13.0.0"
#endif /* VERSION_base */
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(major1,major2,minor) (\
(major1) < 4 || \
(major1) == 4 && (major2) < 13 || \
(major1) == 4 && (major2) == 13 && (minor) <= 0)
#endif /* MIN_VERSION_base */
/* package hspec-2.7.4 */
#ifndef VERSION_hspec
#define VERSION_hspec "2.7.4"
#endif /* VERSION_hspec */
#ifndef MIN_VERSION_hspec
#define MIN_VERSION_hspec(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 7 || \
(major1) == 2 && (major2) == 7 && (minor) <= 4)
#endif /* MIN_VERSION_hspec */
/* package leap-1.6.0.10 */
#ifndef VERSION_leap
#define VERSION_leap "1.6.0.10"
#endif /* VERSION_leap */
#ifndef MIN_VERSION_leap
#define MIN_VERSION_leap(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 6 || \
(major1) == 1 && (major2) == 6 && (minor) <= 0)
#endif /* MIN_VERSION_leap */
/* tool gcc-11 */
#ifndef TOOL_VERSION_gcc
#define TOOL_VERSION_gcc "11"
#endif /* TOOL_VERSION_gcc */
#ifndef MIN_TOOL_VERSION_gcc
#define MIN_TOOL_VERSION_gcc(major1,major2,minor) (\
(major1) < 11 || \
(major1) == 11 && (major2) < 0 || \
(major1) == 11 && (major2) == 0 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_gcc */
/* tool ghc-8.8.4 */
#ifndef TOOL_VERSION_ghc
#define TOOL_VERSION_ghc "8.8.4"
#endif /* TOOL_VERSION_ghc */
#ifndef MIN_TOOL_VERSION_ghc
#define MIN_TOOL_VERSION_ghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 8 || \
(major1) == 8 && (major2) == 8 && (minor) <= 4)
#endif /* MIN_TOOL_VERSION_ghc */
/* tool ghc-pkg-8.8.4 */
#ifndef TOOL_VERSION_ghc_pkg
#define TOOL_VERSION_ghc_pkg "8.8.4"
#endif /* TOOL_VERSION_ghc_pkg */
#ifndef MIN_TOOL_VERSION_ghc_pkg
#define MIN_TOOL_VERSION_ghc_pkg(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 8 || \
(major1) == 8 && (major2) == 8 && (minor) <= 4)
#endif /* MIN_TOOL_VERSION_ghc_pkg */
/* tool haddock-2.23.0 */
#ifndef TOOL_VERSION_haddock
#define TOOL_VERSION_haddock "2.23.0"
#endif /* TOOL_VERSION_haddock */
#ifndef MIN_TOOL_VERSION_haddock
#define MIN_TOOL_VERSION_haddock(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 23 || \
(major1) == 2 && (major2) == 23 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_haddock */
/* tool hpc-0.67 */
#ifndef TOOL_VERSION_hpc
#define TOOL_VERSION_hpc "0.67"
#endif /* TOOL_VERSION_hpc */
#ifndef MIN_TOOL_VERSION_hpc
#define MIN_TOOL_VERSION_hpc(major1,major2,minor) (\
(major1) < 0 || \
(major1) == 0 && (major2) < 67 || \
(major1) == 0 && (major2) == 67 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_hpc */
/* tool hsc2hs-0.68.7 */
#ifndef TOOL_VERSION_hsc2hs
#define TOOL_VERSION_hsc2hs "0.68.7"
#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) <= 7)
#endif /* MIN_TOOL_VERSION_hsc2hs */
/* tool pkg-config-1.7.3 */
#ifndef TOOL_VERSION_pkg_config
#define TOOL_VERSION_pkg_config "1.7.3"
#endif /* TOOL_VERSION_pkg_config */
#ifndef MIN_TOOL_VERSION_pkg_config
#define MIN_TOOL_VERSION_pkg_config(major1,major2,minor) (\
(major1) < 1 || \
(major1) == 1 && (major2) < 7 || \
(major1) == 1 && (major2) == 7 && (minor) <= 3)
#endif /* MIN_TOOL_VERSION_pkg_config */
/* tool runghc-8.8.4 */
#ifndef TOOL_VERSION_runghc
#define TOOL_VERSION_runghc "8.8.4"
#endif /* TOOL_VERSION_runghc */
#ifndef MIN_TOOL_VERSION_runghc
#define MIN_TOOL_VERSION_runghc(major1,major2,minor) (\
(major1) < 8 || \
(major1) == 8 && (major2) < 8 || \
(major1) == 8 && (major2) == 8 && (minor) <= 4)
#endif /* MIN_TOOL_VERSION_runghc */
/* tool strip-2.35 */
#ifndef TOOL_VERSION_strip
#define TOOL_VERSION_strip "2.35"
#endif /* TOOL_VERSION_strip */
#ifndef MIN_TOOL_VERSION_strip
#define MIN_TOOL_VERSION_strip(major1,major2,minor) (\
(major1) < 2 || \
(major1) == 2 && (major2) < 35 || \
(major1) == 2 && (major2) == 35 && (minor) <= 0)
#endif /* MIN_TOOL_VERSION_strip */
#ifndef CURRENT_COMPONENT_ID
#define CURRENT_COMPONENT_ID "leap-1.6.0.10-1OMYOoaCAf7BtVC4aNe49e-test"
#endif /* CURRENT_COMPONENT_ID */
#ifndef CURRENT_PACKAGE_VERSION
#define CURRENT_PACKAGE_VERSION "1.6.0.10"
#endif /* CURRENT_PACKAGE_VERSION */

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test-tmp/Main.hi vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test-tmp/Main.o vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test-tmp/Paths_leap.hi vendored

Binary file not shown.

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build/test/test-tmp/Paths_leap.o vendored

Binary file not shown.

26
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/package.conf.inplace/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp.conf vendored

@ -0,0 +1,26 @@
name: leap
version: 1.6.0.10
visibility: public
id: leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp
key: leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp
abi: inplace
exposed: True
exposed-modules: LeapYear
hidden-modules: Paths_leap
import-dirs:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build
library-dirs:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build
dynamic-library-dirs:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/build
data-dir: /var/home/jbiason/Projects/exercism/haskell/leap
hs-libraries: HSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp
depends: base-4.13.0.0
haddock-interfaces:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/doc/html/leap/leap.haddock
haddock-html:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/doc/html/leap

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/package.conf.inplace/package.cache vendored

Binary file not shown.

0
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/package.conf.inplace/package.cache.lock vendored

BIN
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/setup-config vendored

Binary file not shown.

12
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/stack-build-caches/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/lib vendored

@ -0,0 +1,12 @@
/var/home/jbiason/Projects/exercism/haskell/leap/src/LeapYear.hs:
hash: 578ee19067ba10c0e09676fa319ea32d30ac02c145102ffe0d5b189ab76a0f75
size: 219
modtime: 1633536936
/var/home/jbiason/Projects/exercism/haskell/leap/leap.cabal:
hash: feacf24657befef4b966f670087ad8acfadaffcba99df7bfdee83721478f91ac
size: 602
modtime: 1633536883
/var/home/jbiason/Projects/exercism/haskell/leap/package.yaml:
hash: 741adae21e7fab15e96ec98d318f3ec9cbc33dc86f419cd56cd829d6c64a1c54
size: 344
modtime: 1633536454

12
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/stack-build-caches/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/test-test vendored

@ -0,0 +1,12 @@
/var/home/jbiason/Projects/exercism/haskell/leap/test/Tests.hs:
hash: f0e23b421ae686bb35398eb1b91ca2717b945e25cac3203aaa89d09c9ca8cde0
size: 2388
modtime: 1633536455
/var/home/jbiason/Projects/exercism/haskell/leap/leap.cabal:
hash: feacf24657befef4b966f670087ad8acfadaffcba99df7bfdee83721478f91ac
size: 602
modtime: 1633536883
/var/home/jbiason/Projects/exercism/haskell/leap/package.yaml:
hash: 741adae21e7fab15e96ec98d318f3ec9cbc33dc86f419cd56cd829d6c64a1c54
size: 344
modtime: 1633536454

1
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/stack-cabal-mod vendored

@ -0,0 +1 @@
Just used for its modification time

1
haskell/leap/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.0.1.0/stack-test-success vendored

@ -0,0 +1 @@
success

BIN
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/LeapYear.dyn_hi

Binary file not shown.

BIN
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/LeapYear.hi

Binary file not shown.

BIN
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/Paths_leap.dyn_hi

Binary file not shown.

BIN
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/Paths_leap.hi

Binary file not shown.

BIN
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp/libHSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp.a

Binary file not shown.

BIN
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/libHSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp-ghc8.8.4.so

Binary file not shown.

28
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/pkgdb/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp.conf

@ -0,0 +1,28 @@
name: leap
version: 1.6.0.10
visibility: public
id: leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp
key: leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp
abi: 542002b3912f27769b396851c059c5d8
exposed: True
exposed-modules: LeapYear
hidden-modules: Paths_leap
import-dirs:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp
library-dirs:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4/leap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp
dynamic-library-dirs:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/lib/x86_64-linux-ghc-8.8.4
data-dir:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/share/x86_64-linux-ghc-8.8.4/leap-1.6.0.10
hs-libraries: HSleap-1.6.0.10-F6KjsdfzSILCp2Aoll2shp
depends: base-4.13.0.0
haddock-interfaces:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/doc/leap-1.6.0.10/leap.haddock
haddock-html:
/var/home/jbiason/Projects/exercism/haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/doc/leap-1.6.0.10

BIN
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/pkgdb/package.cache

Binary file not shown.

0
haskell/leap/.stack-work/install/x86_64-linux-tinfo6/fb971c408f03a4aa6eda736aa026e53de3540d66efc73bedb1ae6e06b3bc7296/8.8.4/pkgdb/package.cache.lock

BIN
haskell/leap/.stack-work/stack.sqlite3

Binary file not shown.

0
haskell/leap/.stack-work/stack.sqlite3.pantry-write-lock

88
haskell/leap/HELP.md

@ -0,0 +1,88 @@
# Help
## Running the tests
To run the test suite, execute the following command:
```bash
stack test
```
#### If you get an error message like this...
```
No .cabal file found in directory
```
or
```
RedownloadInvalidResponse Request {
...
}
"/home/username/.stack/build-plan/lts-xx.yy.yaml" (Response {responseStatus = Status {statusCode = 404, statusMessage = "Not Found"},
```
You are probably running an old stack version and need
to upgrade it. Try running:
```bash
stack upgrade
```
Or see other options for upgrading at [Stack documentation](https://docs.haskellstack.org/en/stable/install_and_upgrade/#upgrade).
#### Otherwise, if you get an error message like this...
```
No compiler found, expected minor version match with...
Try running "stack setup" to install the correct GHC...
```
Just do as it says and it will download and install
the correct compiler version:
```bash
stack setup
```
If you want to play with your solution in GHCi, just run the command:
```bash
stack ghci
```
## Submitting your solution
You can submit your solution using the `exercism submit src/LeapYear.hs` command.
This command will upload your solution to the Exercism website and print the solution page's URL.
It's possible to submit an incomplete solution which allows you to:
- See how others have completed the exercise
- Request help from a mentor
## Need to get help?
If you'd like help solving the exercise, check the following pages:
- The [Haskell track's documentation](https://exercism.org/docs/tracks/haskell)
- [Exercism's support channel on gitter](https://gitter.im/exercism/support)
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.
## Getting Started
Please refer to the [installation](https://exercism.io/tracks/haskell/installation)
and [learning](https://exercism.io/tracks/haskell/learning) help pages.
## Feedback, Issues, Pull Requests
The [exercism/haskell](https://github.com/exercism/haskell) repository on
GitHub is the home for all of the Haskell exercises.
If you have feedback about an exercise, or want to help implementing a new
one, head over there and create an issue. We'll do our best to help you!
{{ with .Spec.Credits }}

56
haskell/leap/README.md

@ -0,0 +1,56 @@
# Leap
Welcome to Leap on Exercism's Haskell Track.
If you need help running the tests or submitting your code, check out `HELP.md`.
## Instructions
Given a year, report if it is a leap year.
The tricky thing here is that a leap year in the Gregorian calendar occurs:
```text
on every year that is evenly divisible by 4
except every year that is evenly divisible by 100
unless the year is also evenly divisible by 400
```
For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap
year, but 2000 is.
## Notes
Though our exercise adopts some very simple rules, there is more to
learn!
For a delightful, four minute explanation of the whole leap year
phenomenon, go watch [this youtube video][video].
[video]: http://www.youtube.com/watch?v=xX96xng7sAE
To complete this exercise you need to implement the function `isLeapYear`
that takes a year and determines whether it is a leap year.
## Source
### Created by
- @etrepum
### Contributed to by
- @iHiD
- @karen-pal
- @kytrinyx
- @navossoc
- @paulrex
- @petertseng
- @ppartarr
- @rbasso
- @sshine
- @tejasbubane
- @tofische
### Based on
JavaRanch Cattle Drive, exercise 3 - http://www.javaranch.com/leap.jsp

16
haskell/leap/examples/error-nosig/package.yaml

@ -0,0 +1,16 @@
name: leap
dependencies:
- base
library:
exposed-modules: LeapYear
source-dirs: src
tests:
test:
main: Tests.hs
source-dirs: test
dependencies:
- leap
- hspec

4
haskell/leap/examples/error-nosig/src/LeapYear.hs

@ -0,0 +1,4 @@
module LeapYear (isLeapYear) where
isLeapYear year = hasFactor 4 && (not (hasFactor 100) || hasFactor 400)
where hasFactor n = year `rem` n == 0

16
haskell/leap/examples/success-standard/package.yaml

@ -0,0 +1,16 @@
name: leap
dependencies:
- base
library:
exposed-modules: LeapYear
source-dirs: src
tests:
test:
main: Tests.hs
source-dirs: test
dependencies:
- leap
- hspec

34
haskell/leap/leap.cabal

@ -0,0 +1,34 @@
cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.34.2.
--
-- see: https://github.com/sol/hpack
name: leap
version: 1.6.0.10
build-type: Simple
library
exposed-modules:
LeapYear
other-modules:
Paths_leap
hs-source-dirs:
src
ghc-options: -Wall
build-depends:
base
default-language: Haskell2010
test-suite test
type: exitcode-stdio-1.0
main-is: Tests.hs
other-modules:
Paths_leap
hs-source-dirs:
test
build-depends:
base
, hspec
, leap
default-language: Haskell2010

21
haskell/leap/package.yaml

@ -0,0 +1,21 @@
name: leap
version: 1.6.0.10
dependencies:
- base
library:
exposed-modules: LeapYear
source-dirs: src
ghc-options: -Wall
# dependencies:
# - foo # List here the packages you
# - bar # want to use in your solution.
tests:
test:
main: Tests.hs
source-dirs: test
dependencies:
- leap
- hspec

7
haskell/leap/src/LeapYear.hs

@ -0,0 +1,7 @@
module LeapYear (isLeapYear) where
isLeapYear :: Integer -> Bool
isLeapYear year | rem year 4 /= 0 = False
isLeapYear year | rem year 100 /= 0 = True
isLeapYear year | rem year 400 == 0 = True
isLeapYear _year = False

1
haskell/leap/stack.yaml

@ -0,0 +1 @@
resolver: lts-16.21

12
haskell/leap/stack.yaml.lock

@ -0,0 +1,12 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages: []
snapshots:
- completed:
size: 532413
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/16/21.yaml
sha256: 7b5cac89352fa4a88606dc6cb250aee9291f21e2e988d464065f5aa51f5de33d
original: lts-16.21

66
haskell/leap/test/Tests.hs

@ -0,0 +1,66 @@
{-# OPTIONS_GHC -fno-warn-type-defaults #-}
{-# LANGUAGE RecordWildCards #-}
import Data.Foldable (for_)
import Test.Hspec (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
import LeapYear (isLeapYear)
main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs
specs :: Spec
specs = describe "isLeapYear" $ for_ cases test
where
test Case{..} = it explanation assertion
where
explanation = unwords [show input, "-", description]
assertion = isLeapYear (fromIntegral input) `shouldBe` expected
data Case = Case { description :: String
, input :: Integer
, expected :: Bool
}
cases :: [Case]
cases = [ Case { description = "year not divisible by 4 in common year"
, input = 2015
, expected = False
}
, Case { description = "year divisible by 2, not divisible by 4 in common year"
, input = 1970
, expected = False
}
, Case { description = "year divisible by 4, not divisible by 100 in leap year"
, input = 1996
, expected = True
}
, Case { description = "year divisible by 4 and 5 is still a leap year"
, input = 1960
, expected = True
}
, Case { description = "year divisible by 100, not divisible by 400 in common year"
, input = 2100
, expected = False
}
, Case { description = "year divisible by 100 but not by 3 is still not a leap year"
, input = 1900
, expected = False
}
, Case { description = "year divisible by 400 in leap year"
, input = 2000
, expected = True
}
, Case { description = "year divisible by 400 but not by 125 is still a leap year"
, input = 2400
, expected = True
}
, Case { description = "year divisible by 200, not divisible by 400 in common year"
, input = 1800
, expected = False
}
]
-- bd7f470e9ffe40993fc49558a02676ac22827441
Loading…
Cancel
Save