[Haskell-cafe] Ensuring all values of an ADT are explicitly handled OR finding all occurrences of type X in my app
Alan & Kim Zimmerman
alan.zimm at gmail.com
Tue Jan 31 08:41:23 UTC 2017
I can envisage some sort of tooling to fill in all the unmatched cases,
based on the
GHC warnings. Which can make the editing process trivial, for the "make it
work quickly" case.
On 31 January 2017 at 10:11, David Turner <dct25-561bs at mythic-beasts.com>
> I've done exactly this a number of times. The approach I generally take is
> to define a completely new ADT, mark the old one as deprecated, and then
> simply plough through the compiler warnings and errors, which is a mostly
> mechanical process.
> On occasion I've written a (temporary) injection from the old datatype
> into the new one which lets you make the changes piecemeal (by
> topologically sorting the usages) which is nice as if there's any risk of
> making a mistake then tools like `git bisect` can help you find the slip in
> the sea of otherwise identical changes. Doesn't always work smoothly but
> it's often ok.
> This also has the advantage that you don't have to fix all the usages in
> third-party code or dependent libraries straight away. The deprecation step
> need not be immediate, depending on how stable your API is supposed to be.
> On 31 Jan 2017 06:48, "Saurabh Nanda" <saurabhnanda at gmail.com> wrote:
>> Btw, what about the other approach -- listing all possible occurrences of
>> type X throughout the app?
>> -- Saurabh.
>> On Tue, Jan 31, 2017 at 12:15 PM, Saurabh Nanda <saurabhnanda at gmail.com>
>>> We want this at my company too, so we don't write fall-through cases.
>>> That's a short-term workaround, yes. However it doesn't fit into
>>> Haskell's overall story of language-enforced correctness.
>>> -- Saurabh.
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> Only members subscribed via the mailman list are allowed to post.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe