diff options
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 | ||