Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeSyntax #418

Open
id-ekaagr opened this issue Oct 18, 2022 · 4 comments
Open

UnicodeSyntax #418

id-ekaagr opened this issue Oct 18, 2022 · 4 comments

Comments

@id-ekaagr
Copy link

{-# language UnicodeSyntax #-}

module Main where

import Prelude qualified as A

data Term a where
 Lit :: A.Int -> Term A.Int
 Succ :: Term A.Int -> Term A.Int
 IsZero :: Term A.Int -> Term A.Bool
 If :: Term A.Bool -> Term a -> Term a -> Term a
 Pair :: Term a -> Term b -> Term (a, b)

Here no instance of -> gets converted to .

@id-ekaagr
Copy link
Author

Example :

{-# language UnicodeSyntax #-}

module Main where

import Prelude qualified as A

data Detail
 = Detail
 { id             :: String
 , name           :: String
 }
 deriving (Show)

In any record :: is never converted to where UnicodeSyntax is enabled.

@Lev135
Copy link
Contributor

Lev135 commented Nov 18, 2022

Yes, currently, as far as I can see, only three features are supported:
::, ->, => in function type signature.
I've implemented replacement of -> in GADTs in my fork, I'll try to cover at least all the GADTs issues (i. e. => and :: in GADT declaration) and then open a pull request. However, it isn't likely to be very soon, so if someone else will be able to contribute this, it would be great

@id-ekaagr
Copy link
Author

Thanks for addressing this.

Until it's fixed, I'm using this VS Code extension:
https://marketplace.visualstudio.com/items?itemName=adamwalzer.code-replacer

With these settings:

 "codeReplacer.includeDefaultRules": false,
 "codeReplacer.replaceOnSave": true,
 "codeReplacer.rules": {
  "hs": {
   " -< ": " ⤙ ",
   " -<< ": " ⤛ ",
   " -> ": " → ",
   " :: ": " ∷ ",
   " \\(\\| ": " ⦇ ",
   " \\[\\| ": " ⟦ ",
   " \\* ": " ★ ",
   " \\|\\) ": " ⦈ ",
   " \\|\\] ": " ⟧ ",
   " <- ": " ← ",
   " => ": " ⇒ ",
   " >- ": " ⤚ ",
   " >>- ": " ⤜ ",
   " forall ": " ∀ "
  }
 },
 "codeReplacer.statusBarText": "`$(telescope) ${codes.length} code segments to replace`",

@Lev135
Copy link
Contributor

Lev135 commented Dec 27, 2022

Thanks very much for this list! It was very helpful for me. I had a problem to find where >- and >>- are used. If you have an example, please, share it in the comments to PR or add it to it by yourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants