@@ -3,20 +3,19 @@ module Language.PS.CST.Printers.Utils where
33import Prelude
44
55import Data.Array.NonEmpty (NonEmptyArray )
6- import Data.Either (fromRight )
76import Data.Foldable (class Foldable )
87import Data.List (List (..), (:))
98import Data.List (fromFoldable ) as List
109import Data.Maybe (Maybe (..))
1110import Data.Newtype (class Newtype , unwrap )
12- import Data.String.Regex (Regex , regex )
11+ import Data.String.Regex (Regex )
1312import Data.String.Regex as Regex
13+ import Data.String.Regex.Unsafe as Regex
1414import Data.String.Regex.Flags as RegexFlags
1515import Dodo (Doc , bothNotEmpty , break , enclose , encloseEmptyAlt , flexAlt , flexGroup , foldWithSeparator , indent , softBreak , space , spaceBreak , text , (<+>))
1616import Language.PS.CST.ReservedNames (appendUnderscoreIfReserved , isReservedName )
1717import Language.PS.CST.Types.Declaration (Declaration (..), Expr (..), InstanceBinding (..), LetBinding (..))
1818import Language.PS.CST.Types.Leafs (Label (..), ModuleName (..), ProperName , ProperNameType_ConstructorName )
19- import Partial.Unsafe (unsafePartial )
2019
2120-- | >>> dquotes "·"
2221-- "·"
@@ -107,7 +106,7 @@ labelNeedsQuotes (Label name) =
107106
108107unquotedLabelRegex :: Regex
109108unquotedLabelRegex =
110- unsafePartial $ fromRight $ regex " ^[a-z][A-Za-z0-9_]*$" RegexFlags .noFlags
109+ Regex .unsafeRegex " ^[a-z][A-Za-z0-9_]*$" RegexFlags .noFlags
111110
112111unwrapText :: forall a . Newtype a String => a -> Doc Void
113112unwrapText = text <<< appendUnderscoreIfReserved <<< unwrap
0 commit comments