PyF icon indicating copy to clipboard operation
PyF copied to clipboard

Haskell QuasiQuoter for String Formatting

Results 17 PyF issues
Sort by recently updated
recently updated
newest added

``` λ> let bø = [fmt|ø|] :: ByteString; in T.putStrLn $ "ø vs " [fmt|{T.decodeUtf8With T.lenientDecode bø}|] ø vs � λ> ([fmt|ø|]:: ByteString, T.encodeUtf8 "ø") ("\248","\195\184") λ> ([fmt|{T.pack "ø"}|]:: ByteString,...

One can use `:s` to use the `Show` instance for formatting, but I don't remember how I found that out, since it isn't documented anywhere as far as I can...

With PyF: ``` ghci> x = 1.0 :: Double ghci> [fmt|{x}|] "1.0" ghci> [fmt|{x:g}|] "1.000000" ``` In Python ``` >>> f"{1.0:g}" '1' ``` That's convenient because it allows the user...

If the haskell expression contains `:`, it will fail with an unprecise error. ``` {-# LANGUAGE QuasiQuotes #-} import PyF f = ([fmt|{":"}|] :: String) ``` ``` [1 of 2]...

In PyF we have the `{expr:s}` or `{expr}` which converts to string. But it would be nice to have something like python `!r` to force the conversion to a "repr"...

`CPP` move from two files (`ParserEx.hs` and `Meta.hs`) to appear everywhere in the codebase. Should be great if all the compatibility would be limited to a simple module.

enhancement

The conversion from `HsExpr` to template haskell `Exp` is not complete, including: - [ ] No support for advanced pattern match. I.e. `\x -> x` works, but `\(Just x) ->...

It would be great to have a `postProcess`-style hook that applied to each interpolated expression. This would make it much easier to customize the exact behavior of the quasiquoter while...

`parsec` is no longer a dependency provided with GHC, so we should see if we can remove it and replace it by, possibly, https://hackage.haskell.org/package/base-4.16.1.0/docs/Text-ParserCombinators-ReadP.html

I want to make it possible to have a simple derive clause for a newtype like ```haskell newtype Username = Username Text deriving newtype FormatQuote ``` and then automatically have...