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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:25:11+00:00 2026-05-20T23:25:11+00:00

Straight to the point, the type declarations are as follow; type Pnt = (Int,

  • 0

Straight to the point, the type declarations are as follow;

type Pnt = (Int, Int)
type Image = Array Point Int
type Pixels = [Int]
type Dims = (Int, Int)
type Block = (Point,Pixels)

What am trying to do is to get an Image, and from that image obtain a particular block of pixels at position Pnt with a width and length Dims. When working with only one point is fine, no problems or whatsoever;

takeAblock :: Image -> Dims -> Pnt -> Block
takeAblock i (w,h) (x,y) = ((x,y),  [i!(u,v) |  v <-[y..y + h - 1], u <- [x..x + w - 1]])

However when trying to get multiple points I’m finding myself stuck on how what I believed to be a correct implementation, however the compiler does not seem to agree with me

takeManyBlocks :: Image -> Dims -> [Pnt] -> [Block]
takeManyBlocks i d ps = takeAblock i d (map ps)
                                        where ps (x,y) = x  // Error

And the error is the following:

Couldn't match expected type `Pnt'
       against inferred type `[(t, t1)] -> [t]'
In the third argument of `takeAblock', namely `(map ps)'
In the expression: takeAblock i d (map ps)
In the definition of `takeAblock':
    takeAblock i d ps
                = takeAblock i d (map ps)
                where
                    ps (x, y) = x

I really cant understand why this is not working, I even tried map (*1) ps to check whether the lack of a stated function was the problem, but nothing, the compile error remains the same. Where am I going 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-20T23:25:12+00:00Added an answer on May 20, 2026 at 11:25 pm

    The lack of the function is indeed the problem, but not the way you seem to think; something like map (*1) ps is a no-op (for ps a list of numbers, at least). What you really want is something along the lines of map (takeAblock i d) ps; the thing you want to map over the list is the first parameter to map, not sitting somewhere on the other side of it.

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

Sidebar

Related Questions

I'll get straight to the point, I am using jQuery to clone a div
Let's get straight to the point. I made the following code to multiply two
Greetings! Lets cut the excessive intro this time and get straight to the point.
I'm doing some straight up asynchronous calls from javascript using the XMLHTTPRequest object. On
The question wasn't clear enough, I think; here's an updated straight to the point
I've a straight forward question, I think I'm missing some point. My test app
Come straight to the point. A list e.g. lst = [1, 1, 1, 0,
This is a pretty straight forward attempt. I haven't been using python for too
While estimating straight row and table sizes are fairly simple math, we find it
What does STRAIGHT_JOIN do in this code ? SELECT STRAIGHT_JOIN ClosingBalance FROM Accounts WHERE

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.