Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:38:36+00:00 2026-06-17T18:38:36+00:00

first I’d like to appreciate your time answering my question. First, please take a

  • 0

first I’d like to appreciate your time answering my question.

First, please take a quick look at my code. You don’t have to understand the code, just pay attention to the types.

This return an error that says,

Couldn't match expected type `Int' with actual type `Integer'
Expected type: [Int]
  Actual type: [Integer]
In the first argument of `myfun', namely `primes'
In the expression: myfun primes

Failed, modules loaded: none.

I can run this successfully with no error if I change the types to Int instead of Integer, so for example, “primes :: [Int]”

However, I am required to keep it integer for the program to be able to take large numbers.

Thank you very much for your help in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:38:38+00:00Added an answer on June 17, 2026 at 6:38 pm

    The error is coming from (!!) in myfun:

    myfun (a:ab) = fibs !! (a-1) : myfun(ab)
    

    which a newer GHC would have probably informed you about (I think). Try this:

    myfun (a:ab) = fibs !! ((fromInteger a)-1) : myfun(ab)
    

    fromInteger is polymorphic in its result type, so here the type system infers you want an Int. hoogle knows a lot about these kind of questions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first take a look on this picture from localScope app : i have 2
First, to get my concern across take a look at these two code segments
First of all I'm sorry for such a question, I look over the internet
First time user of stackoverflow, but I have followed its development over on Coding
First you should know I have looked into many questions and none of them
first sorry if its a stupid question but im lost a bit. So when
First time ever I'm installing Django (and using python). I run Mac OSX 10.8
First time posting here so I'm sorry if I mess up. I need to
First of all I don't know If controller is the right word. What I
First of all i have to disable the Horizontal panel . I tried with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.