packages feed

syb 0.7.3 → 0.7.4

raw patch · 4 files changed

+27/−18 lines, 4 files

Files

Changelog.md view
@@ -1,3 +1,8 @@+# 0.7.4++- Export new function `gshowsF` that allows more flexibility than `gshows`.+  It allows users to override how some children types should be printed. (https://github.com/dreixel/syb/pull/55)+ # 0.7.3  - Fix `gread` to recognize negative numbers (https://github.com/dreixel/syb/issues/13)
README.md view
@@ -1,17 +1,17 @@ syb: Scrap Your Boilerplate! ================================================================================ -Scrap Your Boilerplate (SYB) is a library for generic programming in Haskell. It -is supported since the GHC >= 6.0 implementation of Haskell. Using this -approach, you can write generic functions such as traversal schemes (e.g., -everywhere and everything), as well as generic read, generic show and generic -equality (i.e., gread, gshow, and geq). This approach is based on just a few -primitives for type-safe cast and processing constructor applications. +Scrap Your Boilerplate (SYB) is a library for generic programming in Haskell. It+is supported since the GHC >= 6.0 implementation of Haskell. Using this+approach, you can write generic functions such as traversal schemes (e.g.,+everywhere and everything), as well as generic read, generic show and generic+equality (i.e., gread, gshow, and geq). This approach is based on just a few+primitives for type-safe cast and processing constructor applications.  It was originally developed by Ralf Lämmel and Simon Peyton Jones. Since then,-many people have contributed with research relating to SYB or its applications. +many people have contributed with research relating to SYB or its applications. -More information is available on the webpage: +More information is available on the webpage: http://www.cs.uu.nl/wiki/GenericProgramming/SYB  @@ -26,9 +26,8 @@ Requirements ------------ -* GHC 6.10.1 or later-* Cabal 1.6 or later-+* GHC 8.0 or later+* Cabal 3.0 or later  Bugs & Support --------------
src/Data/Generics/Text.hs view
@@ -1,15 +1,16 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE RankNTypes #-} ----------------------------------------------------------------------------- -- | -- Module      :  Data.Generics.Text -- Copyright   :  (c) The University of Glasgow, CWI 2001--2003 -- License     :  BSD-style (see the LICENSE file)--- +-- -- Maintainer  :  generics@haskell.org -- Stability   :  experimental -- Portability :  non-portable (uses Data.Generics.Basics) ----- \"Scrap your boilerplate\" --- Generic programming in Haskell +-- \"Scrap your boilerplate\" --- Generic programming in Haskell -- See <http://www.cs.uu.nl/wiki/GenericProgramming/SYB>. The present module -- provides generic operations for text serialisation of terms. --@@ -18,7 +19,7 @@ module Data.Generics.Text (      -- * Generic show-    gshow, gshows,+    gshow, gshows, gshowsF,      -- * Generic read     gread@@ -52,13 +53,16 @@  -- This is a prefix-show using surrounding "(" and ")", -- where we recurse into subterms with gmapQ.-gshows = ( \t ->+gshows = gshowsF gshows++--  | Generic 'shows' but allowing the user to change cases.+gshowsF :: Data b => (forall a. Data a => a -> ShowS) -> b -> ShowS+gshowsF fun = ( \t ->                 showChar '('               . (showString . showConstr . toConstr $ t)-              . (foldr (.) id . gmapQ ((showChar ' ' .) . gshows) $ t)+              . (foldr (.) id . gmapQ ((showChar ' ' .) . fun) $ t)               . showChar ')'          ) `extQ` (shows :: String -> ShowS)-  -- | Generic 'reads' (not 'read'): an alternative to @deriving@ 'Read'. --
syb.cabal view
@@ -1,5 +1,5 @@ name:                 syb-version:              0.7.3+version:              0.7.4 license:              BSD3 license-file:         LICENSE author:               Ralf Lammel, Simon Peyton Jones, Jose Pedro Magalhaes@@ -20,6 +20,7 @@ build-type:             Simple cabal-version:          >= 1.10 tested-with:+  GHC == 9.14   GHC == 9.12   GHC == 9.10   GHC == 9.8