spacechar 0.0.0.2 → 0.0.0.3
raw patch · 3 files changed
+134/−2 lines, 3 files
Files
- changelog.md +4/−0
- spacechar.cabal +2/−2
- src/Data/Char/Space.hs +128/−0
changelog.md view
@@ -1,3 +1,7 @@+0.0.0.3++* Add prism instances for `Char`.+ 0.0.0.2 * Export list and haddock documentation.
spacechar.cabal view
@@ -1,7 +1,7 @@ name: spacechar-version: 0.0.0.2+version: 0.0.0.3 synopsis: Space Character-description: Space Character+description: All the space characters as types license: BSD3 license-file: LICENCE author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>
src/Data/Char/Space.hs view
@@ -1610,6 +1610,104 @@ instance AsSpaceChar SpaceChar where _SpaceChar = id +instance AsSpaceChar Char where+ _SpaceChar =+ prism'+ (\case+ HorizontalTab_ ->+ '\9'+ LineFeed_ ->+ '\10'+ VerticalTab_ ->+ '\11'+ FormFeed_ ->+ '\12'+ CarriageReturn_ ->+ '\13'+ Whitespace_ ->+ '\32'+ NoBreakSpace_ ->+ '\160'+ OghamSpaceMark_ ->+ '\5760'+ EnQuad_ ->+ '\8192'+ EmQuad_ ->+ '\8193'+ EnSpace_ ->+ '\8194'+ EmSpace_ ->+ '\8195'+ ThreePerEmSpace_ ->+ '\8196'+ FourPerEmSpace_ ->+ '\8197'+ SixPerEmSpace_ ->+ '\8198'+ FigureSpace_ ->+ '\8199'+ PunctuationSpace_ ->+ '\8200'+ ThinSpace_ ->+ '\8201'+ HairSpace_ ->+ '\8202'+ NarrowNoBreakSpace_ ->+ '\8239'+ MediumMathematicalSpace_ ->+ '\8287'+ IdeographicSpace_ ->+ '\12288'+ )+ (\case+ '\9' ->+ Just HorizontalTab_+ '\10' ->+ Just LineFeed_+ '\11' ->+ Just VerticalTab_+ '\12' ->+ Just FormFeed_+ '\13' ->+ Just CarriageReturn_+ '\32' ->+ Just Whitespace_+ '\160' ->+ Just NoBreakSpace_+ '\5760' ->+ Just OghamSpaceMark_+ '\8192' ->+ Just EnQuad_+ '\8193' ->+ Just EmQuad_+ '\8194' ->+ Just EnSpace_+ '\8195' ->+ Just EmSpace_+ '\8196' ->+ Just ThreePerEmSpace_+ '\8197' ->+ Just FourPerEmSpace_+ '\8198' ->+ Just SixPerEmSpace_+ '\8199' ->+ Just FigureSpace_+ '\8200' ->+ Just PunctuationSpace_+ '\8201' ->+ Just ThinSpace_+ '\8202' ->+ Just HairSpace_+ '\8239' ->+ Just NarrowNoBreakSpace_+ '\8287' ->+ Just MediumMathematicalSpace_+ '\12288' ->+ Just IdeographicSpace_+ _ ->+ Nothing+ )+ parseSpaceChar :: CharParsing p => p SpaceChar@@ -1853,6 +1951,36 @@ class AsIsoLatin1 a where _IsoLatin1 :: Prism' a IsoLatin1++instance AsIsoLatin1 Char where+ _IsoLatin1 =+ prism'+ (\case+ HorizontalTab__ ->+ '\9'+ LineFeed__ ->+ '\10'+ FormFeed__ ->+ '\12'+ CarriageReturn__ ->+ '\13'+ Whitespace__ ->+ '\32'+ )+ (\case+ '\9' ->+ Just HorizontalTab__+ '\10' ->+ Just LineFeed__+ '\12' ->+ Just FormFeed__+ '\13' ->+ Just CarriageReturn__+ '\32' ->+ Just Whitespace__+ _ ->+ Nothing+ ) instance AsIsoLatin1 IsoLatin1 where _IsoLatin1 = id