Commit graph

147 commits

Author SHA1 Message Date
Profpatsch
b9e16e5349 Add functions that return Exitcodes and Stdout 2015-05-01 16:00:01 +02:00
Gabriel Gonzalez
ebb0d7a507 Changed exit to be a synonym for exitWith
As suggested by @PierreR

This is to make it more strongly typed.  In the long run I'd like there to be a
`Num` instance for `ExitCode` so that we could use numeric literals directly,
but this is good enough for now.
2015-04-06 09:12:31 -07:00
Gabriel Gonzalez
1af5805bb6 Updated documentation
The example for `plus` now uses `plus digit` since `plus anyChar` is obsoleted
by `chars1`
2015-04-05 18:43:39 -07:00
Gabriel Gonzalez
ab3d595b9f Added (.&&.) and (.||.). Fixes #27
These commands behave analogous to their Bash counterparts
2015-04-04 19:35:30 -07:00
Gabriel Gonzalez
e120c0555a Added (&). Fixes #28
For newer versions of base this will just re-export `Data.Function.(&)` and
for older versions I backport the definition.

The purpose of this to allow users to write pipelines from left to right and
without lots of parentheses, like this:

     "123" + "456" & grep "123" & stdout

Thanks to @FranklinChen for the suggestion
2015-04-04 19:21:25 -07:00
Gabriel Gonzalez
119179ad2e Fixed numeric instances for Pattern and Shell
I removed the `Rational` and `Fractional` instances and changed the `Num`
instances

The `Num` instances did not obey the semiring laws, which was the primary
instigator for this change.  However, there is also one very practical reason
for this change, too, which is that the weaker `Monoid` constraint plays
very nicely with `Text` (which is a `Monoid`, but not a `Num`).

This means that now you can do cool things like this for `Shell`:

>>> let x = "1" <|> "2"
>>> let y = "3" <|> "y"
>>> view (x * ", " * y)
"1, 3"
"1, 4"
"2, 3"
"2, 4"

Also, you can now use algebraic operations for `Pattern`s when matching `Text`,
for the same reason.
2015-04-04 17:03:30 -07:00
Gabriel Gonzalez
ea04f280f4 Added the strict utility to the Prelude
This is most useful when you want to run the entire file's contents through a
parser instead of parsing just a single line at a time
2015-03-31 21:19:12 -07:00
Gabriel Gonzalez
771a9543be Merge branch 'master' of github.com:Gabriel439/Haskell-Turtle-Library 2015-03-31 21:09:56 -07:00
Gabriel Gonzalez
4c81a8500e Switched file input utilities to use withTextFile
This fixed encoding issues with unicode input
2015-03-31 21:09:25 -07:00
Gabriel Gonzalez
45219bc991 Merge pull request #36 from maoe/exit
Relax the return type of exit
2015-03-19 19:19:14 -07:00
Mitsutoshi Aoe
a53c80e987 Relax the return type of exit 2015-03-20 09:27:29 +09:00
Gabriel Gonzalez
ac0cd1d853 Fixed tutorial link to point to latest version 2015-03-11 18:58:41 -07:00
Gabriel Gonzalez
3ecc3d6ee7 Added asciiCI 2015-03-08 17:48:53 -07:00
Gabriel Gonzalez
57fcb66c4d Polished source code 2015-03-08 17:45:44 -07:00
Gabriel Gonzalez
0f8b6f00d4 Merge pull request #30 from PierreR/master
Fix haddock for fp
2015-02-26 14:47:04 -08:00
Pierre Radermecker
c38db4b54d Add doctest for fp 2015-02-26 23:30:21 +01:00
Pierre Radermecker
e6b6e73bcd fix fp doc: complete link to FilePath 2015-02-26 11:20:35 +01:00
Pierre Radermecker
4a96c34235 Fix haddock for fp 2015-02-26 11:09:16 +01:00
Gabriel Gonzalez
5e2089ad30 Version 1.0.1 => 1.0.2 2015-02-25 18:26:01 -08:00
Gabriel Gonzalez
4caacd32c5 Some fixes to deslash
Fixed deslash to not remove the trailing slash if it's also the initial slash

Also, I only selectively apply `deslash` for `getDirectoryPermissions`
2015-02-24 09:41:19 -08:00
Gabriel Gonzalez
4e4854402c Fixed ls to to work on ".", "..". Fixes #25
`getDirectoryPermissions` does not work on directories that end with a
trailing slash.  Unfortunately, `Filesystem.Path.decodeString` adds a
trailing slash to the end of the "." and ".." paths.  Also, if you
provide a path with a trailing slash it will fail, too.  This fix
uses a new `deslash` helper function to sanitize paths for
`getDirectoryPermissions`
2015-02-23 22:15:43 -08:00
Gabriel Gonzalez
fbaee429ba Add high-efficiency primitives. Fixes #23
This adds `chars` and `chars1`, which are high-efficiency versions of
`star dot` and `plus dot`, respectively.  I also changed `has`, `prefix`, and
`suffix` to use these high-efficiency primitives and the performance improvement
was dramatic.
2015-02-23 21:07:47 -08:00
Gabriel Gonzalez
5c5c3b5606 Moved "External commands" tutorial section later in tutorial
This is because the section refers to some concepts that were not taught at that
point in the tutorial.  When I hastily created this section I forgot to check
that it was in the proper order.
2015-02-09 18:33:05 -08:00
Gabriel Gonzalez
6e5e9c4b76 Added -threaded to the tutorial
This fixes a bug that occurs when you feed non-empty input to `inshell` in a
compiled program.  Without the flag the program hangs.  I'm not sure why.
2015-02-09 18:25:38 -08:00
Gabriel Gonzalez
fde69d0a56 Merge pull request #20 from happy4crazy/foldIO-typo
Fix typo in Shell `foldIO` law
2015-02-09 16:36:10 -08:00
Alan O'Donnell
35c40335c2 Fix typo in Shell foldIO law 2015-02-09 18:38:49 -05:00
Gabriel Gonzalez
99479998a2 Raised lower bound on base to 4.5. Fixes #18
This technically has no effect because `turtle` depends on `exceptions`,
which already has this lower bound, but it's probably a good idea to put
this lower bound anyway since I haven't verified that versions of `base`
less than 4.5 even work.
2015-02-08 10:04:00 -08:00
Gabriel Gonzalez
dd0afe0a55 Merge pull request #14 from MaxGabriel/patch-2
Fix mismatched parentheses in stdout function
2015-02-04 15:37:34 -08:00
Gabriel Gonzalez
9e45666dd6 Merge pull request #17 from PierreR/master
Fix #16: create a Format specifier for filepaths.
2015-02-04 15:37:25 -08:00
Pierre Radermecker
8dc46a2764 Move the export of fp down after the s 2015-02-04 23:55:13 +01:00
Pierre Radermecker
130d2c11e0 Fix #16: create a Format specifier for filepaths. 2015-02-04 23:47:37 +01:00
Maximilian Tagher
e5ebee4295 Fix mismatched parentheses in stdout function 2015-02-02 21:45:28 -08:00
Gabriel Gonzalez
24c140d7db Version 1.0.0 => 1.0.1 2015-02-02 07:27:05 -08:00
Gabriel Gonzalez
d8cfa343c8 Merge pull request #12 from MaxGabriel/patch-1
Remove duplicate "the" in Tutorial
2015-02-02 06:57:24 -08:00
Gabriel Gonzalez
30c3a902c6 Merge pull request #6 from Gabriel439/shellstreamexample
Extended tutorial to show how to use `inshell`/`inproc`.  Fixes #4
2015-02-02 06:57:06 -08:00
Maximilian Tagher
4b3b7fa2aa Remove duplicate "the" in Tutorial 2015-02-01 22:20:30 -08:00
Gabriel Gonzalez
ad7d68b17f Extended tutorial to show how to use inshell/inproc 2015-01-31 13:41:44 -08:00
Gabriel Gonzalez
522e0106d7 Shout-out to Shelly library in the cabal description 2015-01-31 10:32:06 -08:00
Gabriel Gonzalez
cac54f7999 Generalized type of die 2015-01-31 10:20:21 -08:00
Gabriel Gonzalez
f61a767926 Fix ambiguous type in doctest. Fixes #1 2015-01-31 10:18:46 -08:00
Gabriel Gonzalez
2984ec50d6 Updated documentation 2015-01-29 20:00:23 -08:00
Gabriel Gonzalez
efb0235251 Renamed readLine to readline 2015-01-29 19:55:39 -08:00
Gabriel Gonzalez
e5733082a1 Added installation instructions to top of tutorial 2015-01-29 07:09:17 -08:00
Gabriel Gonzalez
e7ba135181 Added 1-space indent to haddocks code, which interfered with build 2015-01-28 21:00:09 -08:00
Gabriel Gonzalez
5a01ed47ce Added hyperlinks to tutorial code as @ianoc suggested 2015-01-28 20:46:06 -08:00
Gabriel Gonzalez
7a30a36aa4 Updated documentation
This addresses some of @ianoc's comments
2015-01-28 19:51:43 -08:00
Gabriel Gonzalez
44ad04e274 Renamed streaming shell utilities 2015-01-28 19:19:31 -08:00
Gabriel Gonzalez
d97b598999 Added README.md 2015-01-28 19:18:02 -08:00
Gabriel Gonzalez
0c4d49b79f Added .travis.yml 2015-01-28 19:05:57 -08:00
Gabriel Gonzalez
12e5562d0e Fixed rmdir 2015-01-28 07:40:45 -08:00