Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist
dist
.stack-work/
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Now let's look at some complete examples.
import Haquery

example :: Tag
example = html [
example = html [] [
head' [] [],
body [] [
div' [at "id" "main", at "class" "c1"] [
Expand Down Expand Up @@ -117,7 +117,7 @@ Let's do a selection.

```haskell
> select "#main" example
[<div id="main" class="c1">
Right [<div id="main" class="c1">
<div id="sub1"></div>
<div id="sub2"></div>
</div>]
Expand All @@ -129,7 +129,7 @@ If we want to modify tags matching a selector, we can use the alter function.

```haskell
> :t alter
alter :: T.Text -> Tag -> (Tag -> Tag) -> Tag
alter :: T.Text -> (Tag -> Tag) -> Tag -> Either String Tag
```

As we can see, the alter functions needs a selector, a tag to search in, and a function which transforms
Expand All @@ -141,8 +141,8 @@ addClass :: T.Text -> Tag -> Tag
```

```haskell
> alter "div" example (addClass "hello-class")
<html>
> alter "div" (addClass "hello-class") example
Right <html>
<head></head>
<body>
<div id="main" class="c1 hello-class">
Expand All @@ -156,5 +156,5 @@ addClass :: T.Text -> Tag -> Tag
For parsing HTML into `Tag`s, use `parseHtml`:

```haskell
parseHtml :: T.Text -> [Tag]
parseHtml :: T.Text -> Either String [Tag]
```
7 changes: 4 additions & 3 deletions haquery.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/

name: haquery
version: 0.1.1.3
version: 1.0.0.0
synopsis: jQuery for Haskell.
-- description:
homepage: https://github.com/crufter/haquery
Expand All @@ -18,13 +18,14 @@ cabal-version: >=1.8
library
exposed-modules: Haquery
-- other-modules:
build-depends: base >= 4.5 && < 4.10,
build-depends: base,
transformers,
split,
containers,
text,
parsec,
tagsoup
tagsoup,
monad-loops
hs-source-dirs: src

Test-Suite test-haquery
Expand Down
Loading