diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-03-07 16:36:36 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-03-07 16:36:36 -0400 |
| commit | 16a95afa2fe22a4df9c371489c4ee7ffdef8e07b (patch) | |
| tree | 6e0869e78aba03be2591569369e1e099bb86568e /doc/forum/howto_mapM_RevertableProperty | |
| parent | 9bbc292b3f903a1476e3524bb9198e58ce300401 (diff) | |
| parent | 822694e790102efa2a5bb4a0c3d62c6fce1d4e87 (diff) | |
Merge remote-tracking branch 'remotes/misandrist/FreeBSD' into wip
Diffstat (limited to 'doc/forum/howto_mapM_RevertableProperty')
3 files changed, 56 insertions, 0 deletions
diff --git a/doc/forum/howto_mapM_RevertableProperty/comment_1_c2800340a5361add82f5e9e30b56b18c._comment b/doc/forum/howto_mapM_RevertableProperty/comment_1_c2800340a5361add82f5e9e30b56b18c._comment new file mode 100644 index 00000000..66ac9a4f --- /dev/null +++ b/doc/forum/howto_mapM_RevertableProperty/comment_1_c2800340a5361add82f5e9e30b56b18c._comment @@ -0,0 +1,22 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2016-02-08T15:00:26Z" + content=""" +combineProperties takes a list of PropertyListType, which is a type family +consisting of [Property NoInfo] and [Property HasInfo]. So, you need to get +from RevertableProperty NoInfo to one of those. `toProp` can do that. + + combineProperties "desc" (map (toProp . myProperty) confs) + +But! I had a look and it was easy to make [RevertableProperty i] an +instance of PropertyListType, which makes what you already tried type check +too. I've done so in git. + +It would perhaps be nice to make lists of various sorts of properties +instances of Traversable, so that mapM etc could be used over them. That +would need some kind of monad for combining properties though, which does +not currently exist. Might make more sense to make an instance of Foldable +or just Monoid for properties. Any improvements in this area would be +appreciated! +"""]] diff --git a/doc/forum/howto_mapM_RevertableProperty/comment_2_1327f1f218433ce262f871771c43452c._comment b/doc/forum/howto_mapM_RevertableProperty/comment_2_1327f1f218433ce262f871771c43452c._comment new file mode 100644 index 00000000..20f6e640 --- /dev/null +++ b/doc/forum/howto_mapM_RevertableProperty/comment_2_1327f1f218433ce262f871771c43452c._comment @@ -0,0 +1,23 @@ +[[!comment format=mdwn + username="picca" + subject="comment 2" + date="2016-02-10T06:41:49Z" + content=""" +Thanks a lot joey :) + +I am learning haskell for now and I am not very confortable yet with the haskell Monoid, functor, applicative and monad. + +So what you are saying is that it would be great to do something like + + instance monoid Property where + mempty = doNothing + mappend p1 p2 = combineProperty [p1, p2] + mconcat ps = combineProperty ps + +in order to combine properties. +my question is why did you choose to create combineProperty instead of a Monoid at first ? + +thanks + +Frederic +"""]] diff --git a/doc/forum/howto_mapM_RevertableProperty/comment_3_7e519cc5f1c07b66561ec31866ddbc8a._comment b/doc/forum/howto_mapM_RevertableProperty/comment_3_7e519cc5f1c07b66561ec31866ddbc8a._comment new file mode 100644 index 00000000..79ca2d93 --- /dev/null +++ b/doc/forum/howto_mapM_RevertableProperty/comment_3_7e519cc5f1c07b66561ec31866ddbc8a._comment @@ -0,0 +1,11 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 3""" + date="2016-02-10T16:09:08Z" + content=""" +Would probably be better to use `before`, since `combineProperties` +needs a description of the combined properties. + +Using `doNothing` is kind of a hack, it would make propellor say it was +running "noop property". Perhaps better to use a SemiGroup than a Monoid. +"""]] |
