Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/phadej/idioms-plugins

Hack idiom-brackets using GHC Source Plugin (8.6+)
https://github.com/phadej/idioms-plugins

Last synced: about 21 hours ago
JSON representation

Hack idiom-brackets using GHC Source Plugin (8.6+)

Awesome Lists containing this project

README

        

# idioms-plugin

Hack idiom-brackets using Source Plugin.

As nobody (?) writes their lists as `([1, 2, 3])`, we can steal that syntax!

```haskell
{-# OPTIONS -fplugin=IdiomsPlugin #-}

module Main (main) where

main :: IO ()
main = do
-- Just "foobar"
print ([ mappend (Just "foo") (Just "bar") ])
-- Nothing
print ([ const (Just "foo") Nothing ])
-- Just 3
print ([ (+) (Just 1) (Just (2 :: Int)) ])
```