summaryrefslogtreecommitdiff
path: root/doc/forum/running_propellor_as_a_library/comment_1_a7b8279508cd68e8cfbba238178a7643._comment
blob: 10188525283da02e39b1a4711337863d2aea2c2d (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
[[!comment format=mdwn
 username="joey"
 subject="""comment 1"""
 date="2015-05-27T15:24:07Z"
 content="""
The Utility.* modules are shared amoung several of my projects (git-annex,
propeller, github-backup, ..), but I'm not really happy enough with them to
make them a proper haskell library. 

For one thing, there's no unifying principle; it's just whatever bits of
code I happened to write that were refactorable out of the main program. I
don't want to end up with another MissingH like tarball library here.

And for another thing, I don't think I want to commit to api stability, or
even api versioning for all of that stuff.

Some parts of it, I'm somewhat happier with, and hope to eventually break
out into proper haskell libraries. For example, Utility.Scheduled is pretty
good (and mostly re-exported from Propellor.Property.Scheduled anyway).

OTOH, Utility.Process .. not happy with that at all from a design POV.
I'd recommend you just use System.Process, or
[Data.Streaming.Process](http://hackage.haskell.org/package/streaming-commons-0.1.12/docs/Data-Streaming-Process.html).
Although there is the problem that `PROPELLOR_DEBUG` relies on
Utility.Process adding calls to debugging functions, so you'd need to do that
by hand.

Maybe what makes sense is for some part of propellor to re-export qualified
subsets of `Utility.*`, on a case-by-case basis as users find need for them.
I counted the Utility imports inside Propellor.Property, they are:

	17 import Utility.SafeCommand
	 8 import Utility.FileMode
	 2 import Utility.Path
	 2 import Utility.Env
	 2 import Utility.DataUnits
	 1 import Utility.ThreadScheduler
	 1 import Utility.Scheduled
	 1 import Utility.FileSystemEncoding
	 1 import Utility.Applicative

So, I'm inclined to have Propellor.Property.Cmd re-export Utility.SafeCommand,
and leave it at that for now. It makes sense that propellor export a primitive
that runs a command to a Bool, does any requested debug output, for use by the
many Properties that involve running commands.

(If you want to break out some part of Utility into a separate library
and maintain it, I'd be ok with that too.)
"""]]