Best VPN Service (English Banners)

GeekBuying.com

Discovering Haskell SYNOTES& TESTING

Alibaba Cloud
Autonomous Standing Desk

System Mechanic® Ultimate Defense™
Save up to 50% on ANSI Standards Packages

*Main Lib Data.List> let digits2 n = (div n 10, mod n 10)

*Main Lib Data.List> digits2 10

IK Multimedia's T-RackS 5

(1,0)

*Main Lib Data.List> digits2 10019

(1001,9)

Autonomous Standing Desk

*Main Lib Data.List> let convert2 = combine2 . digits2

<interactive>:83:16: error:

    Variable not in scope: combine2 :: (b, b) -> c

*Main Lib Data.List> :t digits2

digits2 :: Integral b => b -> (b, b)


ghci>:t 1

1 :: Num p => p

ghci>[1,2,3]++[]

[1,2,3]

ghci>[1,2,3]++[3,2,1]

[1,2,3,3,2,1]

ghci>”Hello” ++” World!”

“Hello World!”

ghci>sin 0.5

0.479425538604203

ghci>sin(sin0.5)

<interactive>:115:5: error:

    • Variable not in scope: sin0 :: b0 -> c

    • Perhaps you meant one of these:

        ‘sin’ (imported from Prelude), ‘sinh’ (imported from Prelude)

ghci>sin(sin 0.5)

0.4612695550331807


IN ORDER TO RUN TEST, WE AMEND THE SPEC IN TEST:

(USING stack test TO RUN TESTS)

import Test.Hspec
import Lib

main :: IO ()
— main = putStrLn “Test suite not yet implemented”

— main = hspec $ do
— describe “HOW TO WRITE A TEST” $ do
— it “SHOULD BE ABLE TO RUN TESTS” $ do
— someString `shouldBe` “someString”
— someString `shouldBe` “another String”

main = hspec $ do
describe “formatGrid” $ do
it “SHOULD CONCATENATE EVERY LINE WITH A NEW LINE” $ do
(formatGrid [“abc”, “def”, “ghi”]) `shouldBe` “abc\ndef\nghi\n”

describe “findWord” $ do
it “SHOULD FIND WORDS THAT EXIST ON THE GRID” $ do
findWord grid “HASKELL” `shouldBe` Just “HASKELL”
findWord grid “PERL” `shouldBe` Just “PERL”
it “SHOULD NOT FIND WORDS THAT DO NOT EXIST ON THE GRID” $ do
findWord grid “HAMSTER” `shouldBe` Nothing

describe “findWords” $ do
it “SHOULD FIND ALL THE WORDS EXIST ON THE GRID” $ do
findWords grid languages `shouldBe` languages
it “SHOULD NOT FIND ALL THE WORDS EXIST ON THE GRID” $ do
findWords grid[“FRENCH”, “GERMAN”, “ENGLISH”] `shouldBe` []

(base) Sues-MacBook:helloworld sylive$ stack test

/Users/sylive/Env1/haskell/helloworld/helloworld.cabal was modified manually. Ignoring /Users/sylive/Env1/haskell/helloworld/package.yaml in favor of the cabal file.

If you want to use the package.yaml file instead of the cabal file,

then please delete the cabal file.

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail

Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail

helloworld-0.1.0.0: unregistering (dependencies changed)

helloworld> configure (lib + exe + test)

Configuring helloworld-0.1.0.0…

helloworld> build (lib + exe + test)

Preprocessing library for helloworld-0.1.0.0..

Building library for helloworld-0.1.0.0..

[1 of 3] Compiling Data

[2 of 3] Compiling Lib

[3 of 3] Compiling Paths_helloworld

Preprocessing test suite ‘helloworld-test’ for helloworld-0.1.0.0..

Building test suite ‘helloworld-test’ for helloworld-0.1.0.0..

[2 of 2] Compiling Main

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/helloworld-test/helloworld-test …

Preprocessing executable ‘hwexe’ for helloworld-0.1.0.0..

Building executable ‘hwexe’ for helloworld-0.1.0.0..

[1 of 2] Compiling Main

[2 of 2] Compiling Paths_helloworld

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/hwexe/hwexe …

helloworld> copy/register

Installing library in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/lib/x86_64-osx-ghc-8.8.2/helloworld-0.1.0.0-F8idEJzwZgCJzM6GDIIZn1

Installing executable hwexe in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/bin

Registering library for helloworld-0.1.0.0..

helloworld> test (suite: helloworld-test)

            

Progress 1/2: helloworld

formatGrid

  SHOULD CONCATENATE EVERY LINE WITH A NEW LINE FAILED [1]

Failures:

  test/Spec.hs:16:7:

  1) formatGrid SHOULD CONCATENATE EVERY LINE WITH A NEW LINE

       expected: “abc\ndef\nghi”

        but got: “abc\ndef\nghi\n

  To rerun use: –match “/formatGrid/SHOULD CONCATENATE EVERY LINE WITH A NEW LINE/”

Randomized with seed 1646205943

Finished in 0.0011 seconds

1 example, 1 failure

                        

helloworld> Test suite helloworld-test failed

Completed 2 action(s). 

Test suite failure for package helloworld-0.1.0.0

    helloworld-test:  exited with: ExitFailure 1

Logs printed to console

(base) Sues-MacBook:helloworld sylive$ stack test

/Users/sylive/Env1/haskell/helloworld/helloworld.cabal was modified manually. Ignoring /Users/sylive/Env1/haskell/helloworld/package.yaml in favor of the cabal file.

If you want to use the package.yaml file instead of the cabal file,

then please delete the cabal file.

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail

Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail

helloworld-0.1.0.0: unregistering (local file changes: test/Spec.hs)

helloworld> build (lib + exe + test)

Preprocessing library for helloworld-0.1.0.0..

Building library for helloworld-0.1.0.0..

Preprocessing test suite ‘helloworld-test’ for helloworld-0.1.0.0..

Building test suite ‘helloworld-test’ for helloworld-0.1.0.0..

[2 of 2] Compiling Main

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/helloworld-test/helloworld-test …

Preprocessing executable ‘hwexe’ for helloworld-0.1.0.0..

Building executable ‘hwexe’ for helloworld-0.1.0.0..

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/hwexe/hwexe …

helloworld> copy/register

Installing library in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/lib/x86_64-osx-ghc-8.8.2/helloworld-0.1.0.0-F8idEJzwZgCJzM6GDIIZn1

Installing executable hwexe in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/bin

Registering library for helloworld-0.1.0.0..

helloworld> test (suite: helloworld-test)

                        

formatGrid

  SHOULD CONCATENATE EVERY LINE WITH A NEW LINE

Finished in 0.0004 seconds

1 example, 0 failures

helloworld> Test suite helloworld-test passed

Completed 2 action(s).

(base) Sues-MacBook:helloworld sylive$ stack test

/Users/sylive/Env1/haskell/helloworld/helloworld.cabal was modified manually. Ignoring /Users/sylive/Env1/haskell/helloworld/package.yaml in favor of the cabal file.

If you want to use the package.yaml file instead of the cabal file,

then please delete the cabal file.

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail

Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail

helloworld-0.1.0.0: unregistering (local file changes: test/Spec.hs)

helloworld> build (lib + exe + test)

Preprocessing library for helloworld-0.1.0.0..

Building library for helloworld-0.1.0.0..

Preprocessing test suite ‘helloworld-test’ for helloworld-0.1.0.0..

Building test suite ‘helloworld-test’ for helloworld-0.1.0.0..

[2 of 2] Compiling Main

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/helloworld-test/helloworld-test …

Preprocessing executable ‘hwexe’ for helloworld-0.1.0.0..

Building executable ‘hwexe’ for helloworld-0.1.0.0..

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/hwexe/hwexe …

helloworld> copy/register

Installing library in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/lib/x86_64-osx-ghc-8.8.2/helloworld-0.1.0.0-F8idEJzwZgCJzM6GDIIZn1

Installing executable hwexe in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/bin

Registering library for helloworld-0.1.0.0..

helloworld> test (suite: helloworld-test)

                        

formatGrid

  SHOULD CONCATENATE EVERY LINE WITH A NEW LINE

findWord

  SHOULD FIND WORDS THAT EXIST ON THE XXX

Finished in 0.0005 seconds

2 examples, 0 failures

helloworld> Test suite helloworld-test passed

Completed 2 action(s).

(base) Sues-MacBook:helloworld sylive$ stack test

/Users/sylive/Env1/haskell/helloworld/helloworld.cabal was modified manually. Ignoring /Users/sylive/Env1/haskell/helloworld/package.yaml in favor of the cabal file.

If you want to use the package.yaml file instead of the cabal file,

then please delete the cabal file.

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail

Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail

helloworld-0.1.0.0: unregistering (local file changes: test/Spec.hs)

helloworld> build (lib + exe + test)

Preprocessing library for helloworld-0.1.0.0..

Building library for helloworld-0.1.0.0..

Preprocessing test suite ‘helloworld-test’ for helloworld-0.1.0.0..

Building test suite ‘helloworld-test’ for helloworld-0.1.0.0..

[2 of 2] Compiling Main

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/helloworld-test/helloworld-test …

Preprocessing executable ‘hwexe’ for helloworld-0.1.0.0..

Building executable ‘hwexe’ for helloworld-0.1.0.0..

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/hwexe/hwexe …

helloworld> copy/register

Installing library in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/lib/x86_64-osx-ghc-8.8.2/helloworld-0.1.0.0-F8idEJzwZgCJzM6GDIIZn1

Installing executable hwexe in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/bin

Registering library for helloworld-0.1.0.0..

helloworld> test (suite: helloworld-test)

                        

formatGrid

  SHOULD CONCATENATE EVERY LINE WITH A NEW LINE

findWord

  SHOULD FIND WORDS THAT EXIST ON THE GRID FAILED [1]

Failures:

  test/Spec.hs:22:7:

  1) findWord SHOULD FIND WORDS THAT EXIST ON THE GRID

       expected: Just “HAMSTER”

        but got: Nothing

  To rerun use: –match “/findWord/SHOULD FIND WORDS THAT EXIST ON THE GRID/”

Randomized with seed 436368331

Finished in 0.0015 seconds

2 examples, 1 failure

helloworld> Test suite helloworld-test failed

Completed 2 action(s).

Test suite failure for package helloworld-0.1.0.0

    helloworld-test:  exited with: ExitFailure 1

Logs printed to console

(base) Sues-MacBook:helloworld sylive$ stack test

/Users/sylive/Env1/haskell/helloworld/helloworld.cabal was modified manually. Ignoring /Users/sylive/Env1/haskell/helloworld/package.yaml in favor of the cabal file.

If you want to use the package.yaml file instead of the cabal file,

then please delete the cabal file.

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail

Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail

helloworld-0.1.0.0: unregistering (local file changes: test/Spec.hs)

helloworld> build (lib + exe + test)

Preprocessing library for helloworld-0.1.0.0..

Building library for helloworld-0.1.0.0..

Preprocessing test suite ‘helloworld-test’ for helloworld-0.1.0.0..

Building test suite ‘helloworld-test’ for helloworld-0.1.0.0..

[2 of 2] Compiling Main

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/helloworld-test/helloworld-test …

Preprocessing executable ‘hwexe’ for helloworld-0.1.0.0..

Building executable ‘hwexe’ for helloworld-0.1.0.0..

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/hwexe/hwexe …

helloworld> copy/register

Installing library in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/lib/x86_64-osx-ghc-8.8.2/helloworld-0.1.0.0-F8idEJzwZgCJzM6GDIIZn1

Installing executable hwexe in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/bin

Registering library for helloworld-0.1.0.0..

helloworld> test (suite: helloworld-test)

            

Progress 1/2: helloworld

formatGrid

  SHOULD CONCATENATE EVERY LINE WITH A NEW LINE

findWord

  SHOULD FIND WORDS THAT EXIST ON THE GRID

  SHOULD NOT FIND WORDS THAT DO NOT EXIST ON THE GRID

Finished in 0.0013 seconds

3 examples, 0 failures

                        

helloworld> Test suite helloworld-test passed

Completed 2 action(s). 

(base) Sues-MacBook:helloworld sylive$ stack test

/Users/sylive/Env1/haskell/helloworld/helloworld.cabal was modified manually. Ignoring /Users/sylive/Env1/haskell/helloworld/package.yaml in favor of the cabal file.

If you want to use the package.yaml file instead of the cabal file,

then please delete the cabal file.

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail

Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail

helloworld-0.1.0.0: unregistering (local file changes: test/Spec.hs)

helloworld> build (lib + exe + test)

Preprocessing library for helloworld-0.1.0.0..

Building library for helloworld-0.1.0.0..

Preprocessing test suite ‘helloworld-test’ for helloworld-0.1.0.0..

Building test suite ‘helloworld-test’ for helloworld-0.1.0.0..

[2 of 2] Compiling Main

            

/Users/sylive/Env1/haskell/helloworld/test/Spec.hs:27:32: error:

    • Variable not in scope: souldBe :: [String] -> [[Char]] -> a0

    • Perhaps you meant ‘shouldBe’ (imported from Test.Hspec)

   |        

27 |       findWords grid languages `souldBe` languages

   |                                ^^^^^^^^^

            

            

  While building package helloworld-0.1.0.0 using:

      /Users/sylive/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.2 –builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build lib:helloworld exe:hwexe test:helloworld-test –ghc-options ” -fdiagnostics-color=always”

    Process exited with code: ExitFailure 1

Progress 1/2

(base) Sues-MacBook:helloworld sylive$ stack test

/Users/sylive/Env1/haskell/helloworld/helloworld.cabal was modified manually. Ignoring /Users/sylive/Env1/haskell/helloworld/package.yaml in favor of the cabal file.

If you want to use the package.yaml file instead of the cabal file,

then please delete the cabal file.

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail

Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail

helloworld> build (lib + exe + test)

Preprocessing library for helloworld-0.1.0.0..

Building library for helloworld-0.1.0.0..

Preprocessing test suite ‘helloworld-test’ for helloworld-0.1.0.0..

Building test suite ‘helloworld-test’ for helloworld-0.1.0.0..

[2 of 2] Compiling Main

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/helloworld-test/helloworld-test …

Preprocessing executable ‘hwexe’ for helloworld-0.1.0.0..

Building executable ‘hwexe’ for helloworld-0.1.0.0..

Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/hwexe/hwexe …

helloworld> copy/register

Installing library in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/lib/x86_64-osx-ghc-8.8.2/helloworld-0.1.0.0-F8idEJzwZgCJzM6GDIIZn1

Installing executable hwexe in /Users/sylive/Env1/haskell/helloworld/.stack-work/install/x86_64-osx/e42ee6d1a48136d58c5d9a9e5a96b2a5150c961d1963c467c119e7af826a726e/8.8.2/bin

Registering library for helloworld-0.1.0.0..

helloworld> test (suite: helloworld-test)

            

Progress 1/2: helloworld

formatGrid

  SHOULD CONCATENATE EVERY LINE WITH A NEW LINE

findWord

  SHOULD FIND WORDS THAT EXIST ON THE GRID

  SHOULD NOT FIND WORDS THAT DO NOT EXIST ON THE GRID

findWords

  SHOULD FIND ALL THE WORDS EXIST ON THE GRID

  SHOULD NOT FIND ALL THE WORDS EXIST ON THE GRID

Finished in 0.0025 seconds

5 examples, 0 failures

                        

helloworld> Test suite helloworld-test passed

Completed 2 action(s). 

nordvpn