diff options
author | Tom Smeding <tom@tomsmeding.com> | 2024-10-10 21:09:44 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2024-10-10 21:09:44 +0200 |
commit | 14e902c4a8f5fb35e8188ef763508da26ab5b83f (patch) | |
tree | fefaed9756fca7211c9d7c1762176ffba846237e | |
parent | ccb1e42967ea0e968dc91a9eef5cf597e4b9251f (diff) |
Sync Trace.hs fully with Nested.hs; gentrace.sh monstrosity
-rwxr-xr-x | gentrace.sh | 31 | ||||
-rw-r--r-- | src/Data/Array/Nested/Trace.hs | 4 |
2 files changed, 34 insertions, 1 deletions
diff --git a/gentrace.sh b/gentrace.sh new file mode 100755 index 0000000..7be2b9c --- /dev/null +++ b/gentrace.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +cat <<'EOF' +module Data.Array.Nested.Trace ( + -- * Traced variants + module Data.Array.Nested.Trace, + + -- * Re-exports from the plain "Data.Array.Nested" module +EOF + +sed -n '/^module/,/^) where/!d; /^\s*-- /d; s/ \b[a-z][a-zA-Z0-9_'"'"']*,//g; /^ $/d; s/(\.\., Z.., ([^)]*))/(..)/g; /^ /p; /^$/p' src/Data/Array/Nested.hs + +cat <<'EOF' +) where + +import Prelude hiding (mappend, mconcat) + +import Data.Array.Nested +import Data.Array.Nested.Trace.TH + + +EOF + +# shellcheck disable=SC2016 # dollar in single-quoted string +echo '$(concat <$> mapM convertFun' +sed -n '/^module/,/^) where/!d; /^\s*-- /d; /^ /p' src/Data/Array/Nested.hs | + grep -o '\b[a-z][a-zA-Z0-9_'"'"']*\b' | + grep -wv -e 'pattern' -e 'type' | + tr $'\n' ' ' | + sed 's/\([^ ]\+\)/'"'"'\1,/g; s/, $/])/; s/^/ [/' +echo diff --git a/src/Data/Array/Nested/Trace.hs b/src/Data/Array/Nested/Trace.hs index aeb6edd..838e2b0 100644 --- a/src/Data/Array/Nested/Trace.hs +++ b/src/Data/Array/Nested/Trace.hs @@ -38,7 +38,9 @@ module Data.Array.Nested.Trace ( Mixed, IxX(..), IIxX, - KnownShX(..), StaticShX(..), + ShX(..), KnownShX(..), + StaticShX(..), + SMayNat(..), Elt, PrimElt, |