haskell-tools-refactor-1.0.1.1: examples/Decl/CompletePragma.hs
{-# LANGUAGE PatternSynonyms #-}
module Decl.CompletePragma where
data Choice a = Choice Bool a
pattern LeftChoice :: a -> Choice a
pattern LeftChoice a = Choice False a
pattern RightChoice :: a -> Choice a
pattern RightChoice a = Choice True a
{-# COMPLETE LeftChoice, RightChoice #-}
foo :: Choice Int -> Int
foo (LeftChoice n) = n * 2
foo (RightChoice n) = n - 2