Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add README

  • Loading branch information...
commit 70ed55236c3ae09e9aacf594803b6f258866bddf 1 parent ac03264
@bergmark bergmark authored
Showing with 40 additions and 2 deletions.
  1. +37 −0 README.md
  2. +1 −0  fay-uri.cabal
  3. +2 −2 src/Language/Fay/Uri.hs
View
37 README.md
@@ -0,0 +1,37 @@
+fay-uri
+=======
+
+This is a thin persistent FFI layer for using
+[jsUri](https://github.com/derek-watson/jsUri) with
+[Fay](http://www.fay-lang.org).
+
+See the source code for comments on the implementation, names are kept
+similar to what jsUri uses. Hopefully it's easy to understand even if
+you haven't used jsUri before. The argument order is changed to be
+more haskelly, such as always putting the Uri as the last argument and
+not combining setting and removal functions. Any other changes are
+documented in the source.
+
+Since jsUri is a small library fay-uri also serves as a good example
+on how to write FFI bindings in Fay.
+
+Usage
+-----
+
+To use this with fay, cabal install the package which will put the
+source files in fay ~/.cabal/share/fay-uri-0.1.0.0/src. You can then
+compile with fay using
+
+```bash
+fay --include=~/.cabal/share/fay-uri-0.1.0.0/src MyFile.hs
+```
+
+Example
+-------
+```haskell
+import Language.Fay.Prelude
+import Language.Fay.Uri
+
+main :: Fay ()
+main = putStrLn . removePath . withProtocol "https" =<< currentUri
+```
View
1  fay-uri.cabal
@@ -12,6 +12,7 @@ category: Web
build-type: Simple
cabal-version: >=1.8
+-- This is needed to place the source files in ~/.cabal/share so that we can use fay --include to use the file.
data-files:
src/Language/Fay/Uri.hs
View
4 src/Language/Fay/Uri.hs
@@ -3,8 +3,8 @@
module Language.Fay.Uri where
-import Language.Fay.FFI
-import Language.Fay.Prelude
+import Language.Fay.FFI
+import Language.Fay.Prelude
-- Creation and conversion
Please sign in to comment.
Something went wrong with that request. Please try again.