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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:08:19+00:00 2026-06-04T12:08:19+00:00

Hi I can’t figure this out myself and i also couldn’t find an example

  • 0

Hi I can’t figure this out myself and i also couldn’t find an example online

I’m trying to use a maybe or a guard and the examples i found have just two variables,
when i edit or follow the examples with more then two i get an error heres what i am trying to do

--maybe example
    Fun :: Double -> Double -> Double -> Maybe Double
    Fun a b c
        | a >= -1.0 || a <= 1.0 || b >= -1.0 || b <=1.0 || c /=0 || c >= -1.0 = Nothing
        | otherwise = Just max(  ((c^ (-c)) +   (a^(-c)-1.0)  ^   (a+ (-1.0/a)))     0.0)

error with gchi

 The function `Just' is applied to two arguments,
    but its type `a0 -> Maybe a0' has only one

while hlint gives

No suggestions

trying to use a guard instead i get a different error

--guard example
    Fun :: Double -> Double -> Double -> Maybe Double
    Fun a b c
        | a >= -1.0 || a <= 1.0 || b >= -1.0 || b <=1.0 || c /=0 || c >= -1.0 = error "Value out of range "
        | otherwise = max(  ((c^ (-c)) +   (a^(-c)-1.0)  ^   (a+ (-1.0/a)))     0.0)

and heres ghc and hlints errors

  test.hs:10:1:
        Invalid type signature: Fun :: Double
                                       -> Double -> Double -> Maybe Double
        Should be of form <variable> :: <type>
    $ hlint test.hs
 Error message:
  Left-hand side of type signature is not a variable: Fun
Code:
    Fun :: Double -> Double -> Double -> Maybe Double
  > Fun a b c
  • 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-04T12:08:21+00:00Added an answer on June 4, 2026 at 12:08 pm

    You must write functions with a lower-case letter. This means writing this:

    fun :: Double -> Double -> Double -> Maybe Double
    fun a b c ...
    

    Functions can never start with upper-case letters, since upper-case identifiers are reserved for modules (Data.List for example) and type constructors and data constructors (like Int or Maybe or Just) and some other things.

    You also have an issue with the application of the Just constructor. If you write this:

    Just max(something)
    

    … it means the same thing as:

    Just max something
    

    i.e. you are giving Just two arguments. You need to fix this by adjusting your parens:

    Just (max something)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone help me trying to find out why this doesn't work. The brushes
Can't figure out how to do this in a pretty way : I have
Can I figure out if a function has already been assigned to an event?
Can't seem to figure out what's wrong with the simple getJSON call below. It's
Can anyone explain me what's going on? I use this method - (BOOL)shouldAutorotateToInterfaceOrientation:( UIInterfaceOrientation)interfaceOrientation
Can't work out a way to make an array of buttons in android. This
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
can anyone help me in trying to check whether JavaScript is enabled in client
can I make my own headers in HTTP request ? e.g. This is normal
Can this be done? It seems like this should be possible. In general, I

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.