diff options
author | Frédéric Menou <frederic.menou@fretlink.com> | 2016-12-08 10:19:15 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@fretlink.com> | 2022-05-17 18:01:51 +0200 |
commit | a9d77a20008efe82862cc1adbfa7a6d4f09f8ff7 (patch) | |
tree | adf3186fdccaeef19151026cdfbd38a530cf9ecb /scaffolder/src/Text/Edifact/Scaffolder/Simples/Implementation.hs | |
download | edi-parser-a9d77a20008efe82862cc1adbfa7a6d4f09f8ff7.tar.gz edi-parser-a9d77a20008efe82862cc1adbfa7a6d4f09f8ff7.tar.zst edi-parser-a9d77a20008efe82862cc1adbfa7a6d4f09f8ff7.zip |
Diffstat (limited to 'scaffolder/src/Text/Edifact/Scaffolder/Simples/Implementation.hs')
-rw-r--r-- | scaffolder/src/Text/Edifact/Scaffolder/Simples/Implementation.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scaffolder/src/Text/Edifact/Scaffolder/Simples/Implementation.hs b/scaffolder/src/Text/Edifact/Scaffolder/Simples/Implementation.hs new file mode 100644 index 0000000..6cfb2ab --- /dev/null +++ b/scaffolder/src/Text/Edifact/Scaffolder/Simples/Implementation.hs | |||
@@ -0,0 +1,23 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | ||
2 | |||
3 | module Text.Edifact.Scaffolder.Simples.Implementation | ||
4 | ( -- * | ||
5 | toImplementation | ||
6 | ) where | ||
7 | |||
8 | import Text.Edifact.Scaffolder.Commons | ||
9 | import Text.Edifact.Scaffolder.Simples.Types | ||
10 | |||
11 | import Formatting | ||
12 | |||
13 | toImplementation :: Representation -> Text | ||
14 | toImplementation (Representation content (UpTo n) ) = sformat (fContent % " `upTo` " % int) content n | ||
15 | toImplementation (Representation content (Exactly n)) = sformat (fContent % " `exactly` " % int) content n | ||
16 | toImplementation (Representation content AnyNumber ) = sformat ("many " % fContent) content | ||
17 | |||
18 | fContent :: Format t (Content -> t) | ||
19 | fContent = | ||
20 | let display AlphaNumeric = "alphaNumeric" | ||
21 | display Alpha = "alpha" | ||
22 | display Numeric = "numeric" | ||
23 | in mapf display stext | ||