| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 | 
module Options where
import           FlatCurry.Types
import           GetOpt
import           ReadNumeric                    ( readNat )
import           List                           ( intercalate
                                                , last
                                                , splitOn
                                                )
data Options = Options
  { optHelp      :: Bool 
  , optVerb      :: Int 
  , optStore     :: Bool  
  , optFunctions :: [QName]  
  }
defaultOptions :: Options
defaultOptions =
  Options {optHelp = False, optVerb = 1, optStore = True, optFunctions = []}
usageText :: String
usageText = usageInfo ("Usage: synsf [options] <module names>\n") options
options :: [OptDescr (Options -> Options)]
options =
  [ Option "h?"
           ["help"]
           (NoArg (\opts -> opts { optHelp = True }))
           "print help and exit"
  
  
  
  
  
  , Option "f"
           ["function"]
           (ReqArg addFuncName "<n>")
           "name of function for which the set function should be synthesized"
  
  
  
  ]
 where
  
  
  
  
  
  
  
  
  addFuncName name opts =
    let
      nameparts = splitOn "." name
      partnums  = length nameparts
      qname     = if partnums < 2
        then ("", name)
        else (intercalate "." (take (partnums - 1) nameparts), last nameparts)
    in
      opts { optFunctions = qname : optFunctions opts }
 |