summaryrefslogtreecommitdiff
path: root/doc/forum/howto_mapM_RevertableProperty.mdwn
blob: 7ebcbd47a255baae6c63368781f08deb70542aeb (plain)
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
Hello

I have this kind of property

    myProperty :: Conf -> RevertableProperty NoInfo


now I have a [Conf] and I want to create also a RevertableProperty NoInfo which apply myProperty for each Conf

I tried to find an equivalent of mapM for properties but I found nothing which works as expected.

I tried with combineProperties but it failed also with a "cryptic message"
mpoints is the [Conf]


    src/config.hs:250:17:
    Couldn't match type `CInfo
                           (PropertyListType (Property [NoInfo]))
                           (PropertyListType (Property [NoInfo]))'
                  with `NoInfo'
    Expected type: RevertableProperty NoInfo
      Actual type: RevertableProperty
                     (CInfo
                        (PropertyListType (Property [NoInfo]))
                        (PropertyListType (Property [NoInfo])))
    In the expression: mount <!> umount
    In an equation for `mountExp':
        mountExp b
          = mount <!> umount
          where
              mount
                = combineProperties
                    "mount nfs files" (mapM mount'' mpoints)
              umount
                = combineProperties
                    "umount nfs files" (mapM umount'' mpoints)
              mpoints
                = [MountConf
                     "nfs"
                     ("ruche-"
                      ++
                        beamline ++ ".mydomain.org:/" ++ beamline ++ "-users")
                     ("/nfs/ruche-" ++ beamline ++ "/" ++ beamline ++ "-users"),
                   ....]
              beamline = show b

What is the right way to create a RevertableProperty from a list of RevertableProperty

thanks

Frederic