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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:28:51+00:00 2026-05-26T09:28:51+00:00

Two module Up.hs and Down.hs module Up (isSortedUp) where isSortedUp x y z =

  • 0

Two module Up.hs and Down.hs

module Up (isSortedUp) where
isSortedUp x y z = if x>y && y>z then return(True) else return(False)


module Down (isSortedDown) where
isSortedDown x y z = if x<y && y<z then return(True) else return(False)

And the main program Main.hs

import System.Environment
import Up
import Down
main = do
  args<-getArgs
  let a = read(args !! 0)
  let b = read(args !! 1)
  let c = read(args !! 2)
  if (isSortedUp a b c || isSortedDown a b c) 
    then putStrLn "True" 
    else putStrLn "False"

During compilation I get the following error:

Couldn't match expected type `Bool' with actual type `m0 Bool'
In the return type of a call of `isSortedUp'
In the first argument of `(||)', namely `isSortedUp a b c '
In the expression: (isSortedUp a b c || isSortedDown 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-05-26T09:28:51+00:00Added an answer on May 26, 2026 at 9:28 am

    You seem to be confused about return. It is not a keyword for returning values like in other programming languages. In Haskell, return is a function that promotes a pure value to a monadic one (e.g. an Int to an IO Int). You don’t use it for non-monadic code.

    isSortedUp x y z = if x>y && y>z then True else False
    

    Also, instead of writing if foo then True else False, you can simply write foo:

    isSortedUp x y z = x>y && y>z
    

    Your main function can also be simplified a little using pattern matching and the fact that print on booleans prints "True" or "False".

    main = do
      (a:b:c:_) <- getArgs
      print (isSortedUp a b c || isSortedDown a b c)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a Python module, and I have two versions: a pure Python
I'm using the iis7 URL Rewrite module and it's working fine, except for two
Suppose I have a dataset with those two immortal tables: Employee & Order Emp
Lets say I have two modules. Is it possible to include a module inside
I'm using System V Shared Memory to communicate between my two PHP applications. One
In Python, what happens when two modules attempt to import each other? More generally,
On nginx website they are two module for HTTP PUSH. Here they are: http://pushmodule.slact.net/
I have two perl module files like : is_date_holiday.pl : use strict; use warnings;
I have a View Feedback page with two drop down lists to filter the
Ok I have two modules, each containing a class, the problem is their classes

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.