]> git.immae.eu Git - github/fretlink/edi-parser.git/blob - scaffolder/src/Text/Edifact/Scaffolder/Simples/Implementation.hs
Release code as open source
[github/fretlink/edi-parser.git] / scaffolder / src / Text / Edifact / Scaffolder / Simples / Implementation.hs
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