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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:19:50+00:00 2026-05-23T01:19:50+00:00

In answering a question on stackoverflow, I noticed that GHCi (interactive) is assigning a

  • 0

In answering a question on stackoverflow, I noticed that GHCi (interactive) is assigning a too-restrictive type in a let statement. Namely, given the code,

import Control.Arrow
f = maximum &&& id >>> fst &&& (\(m,l) -> length $ filter (==m) l)

(as on my answer to https://stackoverflow.com/questions/6281813/maximum-of-list-and-count-of-repeat-maximum-number/6283594#6283594), if one inserts a “let” before f and enters this in ghci, it gives the following type information

Prelude Control.Arrow> :t f
f :: [()] -> ((), Int)

whereas just asking for the type of the expression gives the correct result, namely Ord a => [a] -> (a, Int). I’m using ghc 7.0.3.

  • 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-23T01:19:51+00:00Added an answer on May 23, 2026 at 1:19 am

    See the extended defaulting rules used in GHCi for an explanation of where the () is coming from.

    As for why the defaulting occurs in this case, compare the following:

    > let f x = maximum &&& id >>> fst &&& (\(m,l) -> length $ filter (==m) l) $ x
    > :t f
    f :: (Ord a) => [a] -> (a, Int)
    

    I assume this has something to do with bindings being monomorphic, but I’m not certain of the details.

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

Sidebar

Related Questions

While answering this question I noticed that I have never come across any property
In answering this question ( https://stackoverflow.com/questions/352317/c-coding-question#352327 ), it got me wondering... Is there any
This came up when answering another user's question (TheSoftwareJedi)... Given the following table: ROW_PRIORITY
While answering Static class variables in Python I noticed that PythonWin PyWin32 build 209.2
my first question on Stackoverflow. Let me start with a bit of code. It's
I'll be answering this question To my great surprise, I discovered that, after using
I've trained a system on SVM,that is given a question,whether the webpage is a
When answering this question I made some research which really confuses me. I noticed
As part of answering another question, I wanted to show that the insane level
When answering another question I started to wonder how I could Add new properties

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.