Coder Social home page Coder Social logo

Comments (3)

twolodzko avatar twolodzko commented on May 22, 2024 1

OK, now I understood what you meant.

from learn4haskell.

vrom911 avatar vrom911 commented on May 22, 2024

Hey @twolodzko ! I think that you defined lastDigit as:

lastDigit :: Integer -> Integer

while

firstDigit :: Int -> Int

It is better to have consistent types here πŸ™‚
Hope it helps!

from learn4haskell.

twolodzko avatar twolodzko commented on May 22, 2024

@vrom911 thanks, but I also tried using Integer instead and I still get

test/Test/Chapter1.hs:72:14: error:
    β€’ Couldn't match expected type β€˜Int’ with actual type β€˜Integer’
    β€’ In the first argument of β€˜(===)’, namely β€˜(firstDigit x :: Int)’
      In a stmt of a 'do' block:
        (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
      In the second argument of β€˜($)’, namely
        β€˜do x <- forAll $ Gen.int (Range.linear (- 200) 200)
            (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)’
   |
72 |             (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
   |              ^^^^^^^^^^^^

test/Test/Chapter1.hs:72:25: error:
    β€’ Couldn't match expected type β€˜Integer’ with actual type β€˜Int’
    β€’ In the first argument of β€˜firstDigit’, namely β€˜x’
      In the first argument of β€˜(===)’, namely β€˜(firstDigit x :: Int)’
      In a stmt of a 'do' block:
        (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
   |
72 |             (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
   |                         ^

test/Test/Chapter1.hs:72:40: error:
    β€’ Couldn't match expected type β€˜Int’ with actual type β€˜Integer’
    β€’ In the second argument of β€˜(===)’, namely
        β€˜(lastDigit (reverseInt x) :: Int)’
      In a stmt of a 'do' block:
        (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
      In the second argument of β€˜($)’, namely
        β€˜do x <- forAll $ Gen.int (Range.linear (- 200) 200)
            (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)’
   |
72 |             (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^

test/Test/Chapter1.hs:72:51: error:
    β€’ Couldn't match expected type β€˜Integer’ with actual type β€˜Int’
    β€’ In the first argument of β€˜lastDigit’, namely β€˜(reverseInt x)’
      In the second argument of β€˜(===)’, namely
        β€˜(lastDigit (reverseInt x) :: Int)’
      In a stmt of a 'do' block:
        (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
   |
72 |             (firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
   |                                                   ^^^^^^^^^^^^
make: *** [Makefile:12: test-chapter1] Error 1

from learn4haskell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.