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

  • SEARCH
  • Home
  • 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 9149969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:32:59+00:00 2026-06-17T11:32:59+00:00

I am curious about where getZipList is defined in ghc. Control.Applicative has this definition

  • 0

I am curious about where getZipList is defined in ghc.
Control.Applicative has this definition for ZipList.

newtype ZipList a = ZipList { getZipList :: [a] }

One way to use ZipLists is (from LYAH):

ghci> getZipList $ (+) <$> ZipList [1,2,3] <*> ZipList [100,100,100]

[101,102,103]

I am curious how getZipList knows what to return.
Perhaps I am missing something about the newtype keyword.
Thanks!

  • 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-17T11:33:00+00:00Added an answer on June 17, 2026 at 11:33 am

    It’s not just newtype, it works the same with data. What you seem to be unaware of is named field syntax,

    newtype ZipList a = ZipList { getZipList :: [a] }
    

    is almost the same as

    newtype ZipList a = ZipList [a]
    
    getZipList :: ZipList a -> [a]
    getZipList (ZipList xs) = xs
    

    but the named field syntax allows more convenient updating and pattern matching – in particular it’s much more convenient for named fields in data types with multiple fields.

    The named field (implicitly) defines the accessor function that extracts the contained data from the wrapped value.

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

Sidebar

Related Questions

I'm quite curious about this. In a broad way, how does one go about
I'm curious about what be the best way to model this for optimized performance...
I was curious about how other people use the this keyword. I tend to
Just curious about the best way to go about this. I want to make
Just curious about this, I have one server our dev where a ridiculous amount
I'm curious about the correct way to architect an application that consists of the
I am a bit curious about how this works - if I have 5
I am curious about the use of the function named test (line 3) below:
Was curious about the correct definition of the overridden method and the overriding method.
I am just curious about the doctype use in Google, Yahoo and Stackoverflow. And

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.