Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Derived data (Mark Carter)
   2. Re:  Derived data (Michael Alan Dorman)


----------------------------------------------------------------------

Message: 1
Date: Tue, 24 Mar 2015 09:48:09 +0000
From: Mark Carter <[email protected]>
To: [email protected]
Subject: [Haskell-beginners] Derived data
Message-ID: <[email protected]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I read inputs from files into various data types. Not all of the 
information is known at input time, so some of the data for a type needs 
to be derived. The question is: what is the best way of "guarding" 
between derived and underived data?

By that I mean, there is a function which will derive missing data, and 
other functions can only work on derived data. Working on underived data 
would be a mistake.


------------------------------

Message: 2
Date: Tue, 24 Mar 2015 06:21:22 -0400
From: Michael Alan Dorman <[email protected]>
To: Mark Carter <[email protected]>
Cc: [email protected]
Subject: Re: [Haskell-beginners] Derived data
Message-ID: <[email protected]>
Content-Type: text/plain

Mark Carter <[email protected]> writes:
> I read inputs from files into various data types. Not all of the
> information is known at input time, so some of the data for a type
> needs to be derived. The question is: what is the best way of
> "guarding" between derived and underived data?
>
> By that I mean, there is a function which will derive missing data,
> and other functions can only work on derived data. Working on
> underived data would be a mistake.

That seems like the straight-up definition of two data types:

    data Raw = Raw (Maybe Int) Text (Maybe Text)

    data Cooked = Cooked Text

    oven :: Raw -> Cooked

    -- Can't pass Raw data to consumer
    consumer :: Cooked -> Result

Mike.


------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 81, Issue 57
*****************************************

Reply via email to