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

  • SEARCH
  • Home
  • 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 7955507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:43:42+00:00 2026-06-04T03:43:42+00:00

Note: there may be some typos (capitals etc) as my wireless card has broken

  • 0

Note: there may be some typos (capitals etc) as my wireless card has broken on my computer and I cant install haskell on this one, so I am re-typing the code (and I dont have a memory stick xD)

I have been using
Config line values 2 2
to define a Config but I just doesn’t like this one function ‘start’. Anything that takes an f -> f works fine though…

data Config = Config {
                     line :: Line,
                    nums :: [Nums],
                    indent :: Indent,
                       run :: Run
}  deriving (Eq, Show)

class (Result f) => Test f where 
          start :: Line -> [Nums] -> f

 instance Test Config where 
      start line nums = Config line nums 0 0 

If I run

 > start 2 [0,0,0]

which should return

 > Config 2 [0,0,0] 0 0

I get the error:

 Ambiguous type variable `f0' in the constraint:
  (Test f0) arising from a use of `start'
Probable fix: add a type signature that fixes these type variable(s)

running

> :t Config 2 [0,0,0] 0 0 

gives

> Config 2 [0,0,0] 0 0 :: Config 

which is correct

  • 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-04T03:43:43+00:00Added an answer on June 4, 2026 at 3:43 am

    Well, just what the message says,

    start 2 [0,0,0]
    

    can have any type that is an instance of Test. The compiler has no way of finding out without you telling it, either directly with a type signature,

    > start 2 [0,0,0] :: Config
    

    should work without problem, or by supplying context from which the type can be inferred,

    > indent $ start 2 [0,0,0]
    

    should also work because the type can now be inferred by the type of indent that uses the result of start.

    You probably expected the compiler to choose the type Config because at the moment, that’s the only instance of Test. But the compiler never selects an instance because there is no other instance it knows of, since that could break code when other instances are added in different modules.

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

Sidebar

Related Questions

[Note: There is another thread about this problem but it did not answer the
NOTE: I know there are many questions that talked about that but I'm still
There is a note at the end of the atomics package summary that states:
Note: I saw "There appears to be a discrepancy between the solution's source control
NOTE : Right before posting this question it occurred to me there's a better
Is there a GWT Date Time Component? Note: I am already making use of
Note: marked as community wiki. Is there a good analysis of why visual programming
According to MSDN ( http://msdn.microsoft.com/en-us/library/system.windows.forms.label.autosize.aspx ), there's a note about Label 's AutoSize property:
How can I remove the unwanted whitespace in following example? Note 1. that there
I'm working on a web application that has some api calls that send arguments

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.