[Hugs-users] Record puns, time for removal?

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed Nov 1 02:42:49 EST 2006


Hello Iavor,

Tuesday, October 31, 2006, 10:06:01 PM, you wrote:

> By the way, if I recall correctly, in Johan Nordlander's O'Hugs the ..
> notation (called record packing, I think) could also be used to create
> record values.  I think it worked like this:
>> data Point = Point { x,y :: Int }
>> pt = let { x = 3; y = 4 } in Point { .. }

> The ".." is expanded to "{x = x, y = y}" based on the fields for the
> particular constructor.  It seems that if we have the "Point { .. }"
> pattern, we should also have the constructor version.  What do people
> think?

yes, yes, yes! definitely! i'll just show my code:

parseCmdline cmdline = do
      .....
      return$ Just$ Command {
          cmd_name                 = cmd
        , cmd_arcspec              = arcspec
        , cmd_arclist              = error "Using uninitialized cmd_arclist"
        , cmd_arcname              = error "Using uninitialized cmd_arcname"
        , cmd_arc_filter           = const True
        , cmd_filespecs            = filespecs
        , cmd_added_arcnames       = return []
        , cmd_diskfiles            = return []
        , cmd_subcommand           = False

        , opt_scan_subdirs         = scan_subdirs
        , opt_add_dir              = add_dir
        , opt_arc_basedir          = arc_basedir
        , opt_disk_basedir         = disk_basedir
        , opt_group_dir            = group_dir
        , opt_group_data           = group_data
        , opt_data_compressor      = data_compressor
        , opt_dir_compressor       = dir_compressor
        , opt_include_dirs         = include_dirs
        , opt_indicator            = indicator
        , opt_overwrite            = overwrite
        , opt_keep_time            = keep_time
        , opt_time_to_last         = time_to_last
        , opt_test                 = test_files
        , opt_keep_broken          = keep_broken
        , opt_match_with           = match_with
        , opt_append               = append
        , opt_recompress           = recompress
        , opt_noarcext             = noarcext
        , opt_nodir                = nodir
        , opt_debug                = debug
        , opt_cache                = cache
        , opt_update_type          = update_type
        , opt_x_include_dirs       = x_include_dirs
        , opt_match_excluded       = match_excluded
        , opt_sort_order           = sort_order
        , opt_find_group           = find_group . fiFilteredName
        , opt_groups_count         = length group_strings
        , opt_find_type            = find_type  . fiFilteredName
        , opt_types_count          = maximum group_types + 1
        , opt_arccmt_file          = arccmt_file
        , opt_lock_archive         = lock_archive
        , opt_sfx                  = sfx

        , ref_ask_overwrite        = ref_ask_overwrite
        }



-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Glasgow-haskell-users mailing list