Permalink
Browse files

Overloaded strings for routers!

  • Loading branch information...
1 parent 8c4b36e commit 45b2a57f56ccd27747259cab47e2d5d2ef1f907a @MedeaMelana committed Nov 23, 2010
Showing with 6 additions and 0 deletions.
  1. +6 −0 Web/Zwaluw.hs
View
@@ -1,5 +1,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE TypeFamilies #-}
module Web.Zwaluw (
-- * Types
@@ -32,6 +34,7 @@ import Control.Arrow (first, second)
import Data.Monoid
import Data.Maybe (listToMaybe)
import Data.Char (isDigit)
+import GHC.Exts
infixr 8 <>
infixr 8 :-
@@ -45,6 +48,9 @@ data Router a b = Router
{ ser :: b -> [(String -> String, a)]
, prs :: String -> [(a -> b, String)] }
+instance a ~ b => IsString (Router a b) where
+ fromString = lit
+
data a :- b = a :- b deriving (Eq, Show)
hhead :: (a :- b) -> a

0 comments on commit 45b2a57

Please sign in to comment.