[m-rev.] for post-commit review: fix some uint incomplete switches

Paul Bone paul at bone.id.au
Thu Mar 9 10:42:53 AEDT 2017


On Tue, Mar 07, 2017 at 04:34:54PM +1100, Zoltan Somogyi wrote:
> 
> For comparison_result, it is obvious that there will never be a fourth
> functor in the type, but other incomplete switches involve other types
> for which that guarantee can't be given. I think that one possible solution
> is to have humans rewrite such code as
> 
>   require_complete_switch [X]
>   ( X = (<), Result = yes
>   ; X = (=), Result = yes
>   ; X = (>), Result = no
>   ),
>   Result = yes
> 

I often write this kind of code as:

  require_complete_switch [X]
  ( X = (<)
  ; X = (=)
  ; X = (>), false
  )



-- 
Paul Bone
http://paul.bone.id.au


More information about the reviews mailing list