Skip to content

Use TypeOperators for pattern synonyms?

With the language setting -XTypeOperators, I can use varsym expressions, like <|, as type constructors. I would expect that we would then also be able to use them as pattern synonyms; but we can't. This is a request for that to become possible.

{-# LANGUAGE TypeOperators, PatternSynonyms #-}

module Main where

pattern (<|) x xs = Just (x, xs)

main = case Just (1, [2,3]) of { Nothing -> putStrLn "Nothing"; y <| ys -> print y }

gives a parse error.

Trac metadata
Trac field Value
Version 8.0.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information