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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:58:05+00:00 2026-05-22T21:58:05+00:00

Following an example in http://en.wikibooks.org/wiki/Haskell/Beginning Prelude> let abs x = if x < 0

  • 0

Following an example in http://en.wikibooks.org/wiki/Haskell/Beginning

Prelude> let abs x = if x < 0 then -x else x
Prelude> abs 5
5
Prelude> abs -3

<interactive>:1:6:
    No instance for (Num (a0 -> a0))
      arising from the literal `3'
    Possible fix: add an instance declaration for (Num (a0 -> a0))
    In the second argument of `(-)', namely `3'
    In the expression: abs - 3
    In an equation for `it': it = abs - 3

What’s wrong?

  • 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-22T21:58:06+00:00Added an answer on May 22, 2026 at 9:58 pm

    Haskell thinks you’re trying to subtract 3 from abs, and is complaining that abs is not a number. You need to add parenthesis when using the unary negation operator:

    abs (-3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm applying the following example http://jsoup.org/cookbook/extracting-data/example-list-links to list links. package org.jsoup.examples; import org.jsoup.Jsoup; import
Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?
In the documentation concerning Fixtures ( http://api.rubyonrails.org/classes/Fixtures.html ) they provide the following example of
Given the following example: http://jsfiddle.net/A8v9x/4/ - when you click the first link and then
I have the following example http://jsfiddle.net/zidski/Mz9QU/1/ If you click on Link2 and then Link1
Given the following example: http://play.golang.org/p/owvJ8Oi77S func produce(dataChannel chan int) { for i := 0;
I got the following example from http://guides.rubyonrails.org/getting_started.html models/post.rb class Post < ActiveRecord::Base validates :name,
I was following this example http://cubiq.org/create-fixed-size-thumbnails-with-imagemagick , and it's exactly what I want to
I'm trying to compile and run the following example on Ubuntu 10.10 http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/http/server3/ but
Possible Duplicate: Functional programming: currying I'm reading the free F# Wikibook here: http://en.wikibooks.org/wiki/F_Sharp_Programming There's

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.