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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:29:32+00:00 2026-06-18T01:29:32+00:00

Given a datatype data Foo = Foo { one :: Int, two :: String

  • 0

Given a datatype

data Foo = Foo { one :: Int, two :: String } deriving (Show)

An incomplete expression passes typechecking — e.g.

foo :: Foo
foo = Foo { one = 5 }

main = print foo

Typechecks (emitting a warning about the incomplete record), then (obviously) crashes when the expression is encountered. Why does it pass? Without record syntax it doesn’t (i.e. bar = Foo 5 :: Foo).

  • 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-18T01:29:33+00:00Added an answer on June 18, 2026 at 1:29 am

    The Haskell 2010 report says in section 3.15.2 Construction Using Field Labels

    A constructor with labeled fields may be used to construct a value in which the components are specified by name rather than by position. Unlike the braces used in declaration lists, these are not subject to layout; the { and } characters must be explicit. (This is also true of field updates and field patterns.) Construction using field labels is subject to the following constraints: […]

    • Fields not mentioned are initialized to ⊥.

    • A compile-time error occurs when any strict fields (fields whose declared types are prefixed by !) are omitted during construction.

    So it’s part of the language specification and a compiler must accept the code. All fields are initialized, just some are initialised with undefined.

    foo = Foo{ one = 5 }
    

    is equivalent to

    foo = Foo 5 undefined
    

    A nice compiler will warn you about it if you ask it to. If you want an error, make the fields strict.

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

Sidebar

Related Questions

I do an ajax call: $.ajax({ url: '/foo/getData', dataType: 'json', async: false, success: function(data){
Given two classes have only primitive data type and no custom destructor/deallocator. Does C++
I have a scenario where I am given data records at runtime. The datatype
I have two data.frames in R, one of which has two columns and of
Given a MySQL table of real estate data, I would like to generate a
Given that an input String may be specified as follows: read(xpath(‘...’)) or xpath(‘...’) or
I was given a ragtag assortment of data to analyze and am running into
i wish to improve the following function. Given a Pixel data types in GDAL
Given some sample data.xml file: <?xml version=1.0 encoding=utf-8?> <data> <categories> <category id=google> <name>Google</name> </category>
i created a stuct which contains one character and one string struct M2E {

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.