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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:39:57+00:00 2026-06-02T07:39:57+00:00

I often gather multiple values in tuples, since I consider tuples to be the

  • 0

I often gather multiple values in tuples, since I consider tuples to be the natural type for this. However, tuples are not strict. So consider

data A

data B =
    B !A

data C =
    C !(B, B)

data D =
    D !B !B

With -funbox-strict-fields and optimization, UNPACKs are nested. Will the tuple in C be unpacked into C A A as with D, or just C B B? Here is a reference in GHC-doc: 7.16. Pragmas.

(are non-empty tuples types? type-constructors?)

  • 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-02T07:39:58+00:00Added an answer on June 2, 2026 at 7:39 am

    Consider:

    data B = B !Int
    
    data C = C !(B, B)
    
    data D = D !B !B
    
    b0 = B 7
    b1 = B 4
    
    c = C (b0, b1)
    
    d = D b0 b1
    

    where

    data (,) a b = (a,b)
    

    GHC will happily erase nested, strict constructors (!B), and it will make C strict in its first field, optimizing to:

    b0 = B 7
    b1 = B 4
    
    c = C b0 b1
    
    d = D 7 4
    

    However, importantly, the fields of (,) itself are not strict — so GHC can’t unpack them. Furthermore, they’re polymorphic, so it can’t unpack them even if they are strict.

    A work around for the first part is to use strict tuples. The workaround for the second part is to use self-specializing tuples (e.g. type families that specialize tuples).


    Note that using tuples for syntax in this style incurs overhead — they introduce a level of indirection that must be optimized away. As such, it is somewhat unidiomatic.

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

Sidebar

Related Questions

Often times I see something like this: <body> <div class=container> </div> </body> Why not
Often when writing PHP I'll have it output some HTML like this - echo
Often I find myself coming across code like this: try { StreamWriter strw =
Often, I am building an array by iterating through some data, e.g.: my_array =
I'd like to gather some stats about the usage of my application, and since
Often I use cursors in this way: for rec in (select * from MY_TABLE
Often you have to implement a collection because it is not present among those
I often see in PHP MVC applications an Apache RewriteRule that looks like this:
Often I create a static html prototype/skeleton for back-end developers I work with. This
The intention of this question is to gather solutions to date / time calculation

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.