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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:58:54+00:00 2026-05-24T20:58:54+00:00

Is this efficient for checking multiple statements in Haskell? Or this there a better

  • 0

Is this efficient for checking multiple statements in Haskell? Or this there a better way?

case ((x > -10) && (x < 20),x /= 9,(x `mod` 2) == 0,x) of 
    (False,_,_,_) -> error "Not in range"
    (_,False,_,_) -> error "Must not be 9"
    (_,_,False,_) -> error "Must be even"
    (True,True,True,10) -> stuff ()
    (True,True,True,20) -> stuff ()
    _ -> error "Error Message"
  • 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-24T20:58:55+00:00Added an answer on May 24, 2026 at 8:58 pm

    It’s sometimes difficult to come up with small examples of this problem which don’t look contrived, but they do happen. Sometimes you need a bunch of computed results to figure out how to split a function into its cases.

    So yes, I often find it’s cleanest to use case on a tuple of things-I-might-care-about to build complex decision processes. I trust laziness to compute the minimum required to resolve which branch to invoke.

    It’s worth trying to express your tests via Boolean guards (or even pattern guards), but sometimes there’s nothing to beat tabulating the computed values you need in a big tuple and then writing a row for each interesting combination of circumstances.

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

Sidebar

Related Questions

I feel like this is not a very efficient way of using linq. I
Is this the right way of checking whether a directory is empty or not
this c# code is probably not the most efficient but gets what I want
What's the most efficient way to convert the output of this function from a
What is the most efficient way to do this?
What is the most efficient way to do this? Right now I am doing
What's the most efficient way to read a stream into another stream? In this
What is a more efficient way of checking an image's file type? if (($_FILES[file_image][type]
This is undeniable: multicore computers are here to stay. So is this: efficient multicore
In relation to this question ( Efficient hashCode() implementation ) I have one more

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.