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 7411591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:24:35+00:00 2026-05-29T06:24:35+00:00

selectMenu :: Int->IO() selectMenu num |(num==1)=convertFromDecimal |(num==2)=–menu2 |(num==3)=putStrLn(3) |(num==4)=putStrLn(4) |(num==5)=putStrLn(5) convertFromDecimal:: IO() convertFromDecimal= do

  • 0
selectMenu :: Int->IO() 
selectMenu num
        |(num==1)=convertFromDecimal
        |(num==2)=--menu2
        |(num==3)=putStrLn("3")
        |(num==4)=putStrLn("4")
        |(num==5)=putStrLn("5")


convertFromDecimal:: IO()
convertFromDecimal= do 
            putStrLn("\n\tConvert From Decimal To Binary & Octals \n")
            putStrLn("----------------------------------------------------------\n")
            putStrLn("Enter 5 decimal numbers [,,] : ")
            input<-getLine
            let n=(read input)::[Int] -- is this right?
            --putStrLn (show n)
            let result = convertionTO decToOct n
            putStrLn(show result)`



decToOct :: Int -> [Int]
decToOct x = reverse(decToOct' x)
            where
        decToOct' 0 = []
        decToOct' y = let (a,b) = quotRem y 8 in [b] ++ decToOct' a




convertionTO :: (Int -> [Int] -> [Int]) -> [Int] -> [Int]
convertionTO _ [] = []  
convertionTO f (x:xs) = f x : convertionTO f xs

I correct those mistakes. I did update the question after correcting those errors. But this time it gives this error
How can i fix this error?

Assignment.hs:49:51:
    Couldn't match expected type `[Int] -> [Int]'
                with actual type `[Int]'
    Expected type: Int -> [Int] -> [Int]
      Actual type: Int -> [Int]
    In the first argument of `convertionTO', namely `decToOct'
    In the expression: convertionTO decToOct n
Assignment.hs:66:25:
    Couldn't match expected type `Int'
                with actual type `[Int] -> [Int]'
    In the return type of a call of `f'
    In the first argument of `(:)', namely `f x'
    In the expression: f x : convertionTO f xs
  • 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-05-29T06:24:35+00:00Added an answer on May 29, 2026 at 6:24 am

    (I’m copying the errors here in case you edit the question again.)

    The first error

    Assignment.hs:49:51:
        Couldn't match expected type `[Int] -> [Int]'
                    with actual type `[Int]'
        Expected type: Int -> [Int] -> [Int]
          Actual type: Int -> [Int]
        In the first argument of `convertionTO', namely `decToOct'
        In the expression: convertionTO decToOct n
    

    refers to this line of code

                let result = convertionTO decToOct n
    

    conversionTO expects its first argument to have the type Int -> [Int] -> [Int], but decToOct instead has the type Int -> [Int].

    The second error

    Assignment.hs:66:25:
        Couldn't match expected type `Int'
                    with actual type `[Int] -> [Int]'
        In the return type of a call of `f'
        In the first argument of `(:)', namely `f x'
        In the expression: f x : convertionTO f xs
    

    refers to this line of code

    convertionTO f (x:xs) = f x : convertionTO f xs
    

    convertionTO produces an [Int], so the first argument to : must be an Int. But f x instead has type [Int] -> [Int].

    How to fix these?

    I’m going to assume that your line 49 is correct, and that the type signature for convertionTO is wrong. In that case it should be

    convertionTO :: (Int -> [Int]) -> [Int] -> [Int]
    

    This doesn’t fix the second error, as f x now has type [Int].

    The problem here is your use of :. : joins a single element to the start of a list. What you have is two lists that you want to join together. For this, use ++.

    convertionTO f (x:xs) = f x ++ convertionTO f xs
    

    Finally, note that your convertionTO is in the standard library as concatMap, which combines map with concat.

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

Sidebar

Related Questions

Im using an existing widget from the jquery-ui labs call selectmenu. It has callback
i would like to use jquery ui selectmenu from felixnagel. it works but i
I am working with the jquery UI spinoff plugin selectmenu from this github and
I have a class. public class MedicalRequest { private int id private IList<MedicalDays> Days
I have a class. public class MedicalRequest { private int id private IList<MedicalDays> Days
I need select all elements from a set whose Id property is contained within
I'm trying to create a rowcount-query from a regular query, but the resulting SQL
Im using JQuery UI Selectmenu widget - http://wiki.jqueryui.com/w/page/12138056/Selectmenu Im trying to bind change event.
I have two select lists which are being styled using the jQuery UI Selectmenu
private void CalculateFitness(TimeTable timeTable) { int score = 0, DAYS_NUM = 5; score =

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.