<[email protected]> writes:
> case largeMultiConstructorTypedValue of
> Foo{blah=blah,brg=brg} -> .... Some large block...
> Bar{lolz=lolz,foofoo=foofoo} -> ...Another large block...
> Frog{legs=legs,heads=heads} -> Yet another large block...
>
> Where the obvious re-factor is:
> case largeMultiConstructorTypedValue of
> foo@Foo -> processFoo foo
> bar@Bar -> processBar bar
> frog@Frog -> processFrog frog
Hm - is that really so obvious? To me, it seems like the definition
of processFoo will typically be:
processFoo (Foo blah brg) = ...
deconstructing the Foo again. If the Foo is very big, this might be
a good solution, but in many cases, I expect you can do:
case largeMultiConstructorTypedValue of
Foo {blah=blah,brg=brg} -> processBlahBrg blah brg
and this would make the type more specific.
-k
--
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe