-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A quasiquoter for or-patterns -- -- A quasiquoter for or-patterns. It allows one additional form for -- patterns: -- --
--   f [o| p1 | p2 | p3 |] = rhs
--   
-- -- Above, p1, p2 and p3 are three arbitrary -- patterns that bind the same variables. These variables are available -- in the expression rhs. Nesting of or-patterns is not -- supported yet. -- -- See also: -- -- -- --
--   g :: Either (x, y) (y, x) -> (x, y)
--   g [o| Left (x,y) | Right (y,x) |] = (x,y)
--   
-- --
--   -- ends up slightly longer
--   g = elim $ left (pair var var) \/ right flipped ->> (,)
--    where
--     flipped = (\(a,b) -> (b,a)) --> pair var var
--   
-- -- @package OrPatterns @version 0.1 module OrPatterns.Internal -- | parser used in o pats :: String -> Either String PatQ tryParseSplits :: [s] -> ([s] -> Either e r) -> [[s]] -> Either e [r] combineSplits :: [Pat] -> Either String PatQ -- | Quasiquoter for or patterns separated by " | ", like -- other languages (ML family). -- -- Example: -- --
--   >>> :set -XQuasiQuotes -XViewPatterns -w
--   
-- --
--   >>> :{
--   
--   >>> let f :: Either (a,b) (b,a) -> (a,b)
--   
--   >>> f [o| Left (x,y) | Right (y,x) |] = (x,y)
--   
--   >>> :}
--   
-- --
--   >>> map f [Left ('a',0), Right (2, 'b')]
--   [('a',0),('b',2)]
--   
-- -- A more confusing example (to show that the string | is -- interpreted correctly by the parser): -- --
--   >>> :{
--   
--   >>> let g [o| " | " | "|||" | "  |  " |] = True
--   
--   >>> g _ = False
--   
--   >>> :}
--   
-- --
--   >>> map g [ "|", " | " , "|||" , "  |  "]
--   [False,True,True,True]
--   
-- -- f is desugared to something like: -- --
--   f ( (\v -> case v of
--               Left (x,y) -> Just (x,y)
--               Right (y,x) -> Just (x,y)
--               _ -> Nothing
--        ) -> Just (x,y) ) = (x,y)
--   
-- -- So failing to match will pass on to the next equation. -- -- Limitations include: -- -- -- --
--   f2 ( (\v -> case v of
--           Left (x,y) -> (x,y)
--           Right (y,x) -> (x,y))
--          -> a) = a
--   
module OrPatterns -- | or pattern quasiquote. See above. o :: QuasiQuoter