Commits

Alex Suraci committed 29d41e2

atomo/eco updates
Ignore-this: b4d96707c91b62c548387fe70980dfd3

  • Participants
  • Parent commits 0b53db1

Comments (0)

Files changed (1)

 
 load :: VM ()
 load = do
-    ([$p|Website|] =::) =<< eval [$e|Object clone do: { routes = [] }|]
+    ([$p|super Website|] =::) =<< eval [$e|Object clone do: { routes = [] }|]
     ([$p|Snap|] =::) =<< eval [$e|Object clone|]
 
     [$p|(s: Block) snap|] =::: [$e|
         } call/cc
     |]
 
-    [$p|(s: Snap) redirect-to: (url: String)|] =::: [$e|
-        s finish yield: @(redirect-to: url)
-    |]
+    [$p|(s: Snap) redirect-to: (url: String)|] =:::
+        [$e|s finish yield: @(redirect-to: url)|]
 
-    [$p|(s: Snap) send-file: (path: String)|] =::: [$e|
-        s finish yield: @(send-file: path)
-    |]
+    [$p|(s: Snap) send-file: (path: String)|] =:::
+        [$e|s finish yield: @(send-file: path)|]
 
-    [$p|(s: Snap) finish: (body: String)|] =::: [$e|
-        s finish yield: body
-    |]
+    [$p|(s: Snap) finish: (body: String)|] =:::
+        [$e|s finish yield: body|]
 
     env <- get
 
 handle :: Value -> VMT Snap ()
 handle w = do
     e <- getEnv
-    rs <- vm (dispatch (single "routes" w)) >>= toList
+    rs <- vm (dispatch (single "routes" w)) >>= fromList
 
     routes <- forM rs $ \a -> do
-        path <- liftM fromString (vm $ dispatch (single "from" a))
+        path <- liftM (fromText . fromString) (vm $ dispatch (single "from" a))
         handler <- vm $ dispatch (single "to" a)
         return (toBS path, execVM (callHandler path handler w) e errorResponse)
 
 
     case r of
         Particle (PMKeyword ["redirect-to"] [Nothing, Just s]) ->
-            lift . redirect . toBS . fromString $ s
+            lift . redirect . toBS . fromText . fromString $ s
 
         Particle (PMKeyword ["send-file"] [Nothing, Just s]) ->
-            lift . sendFile . fromString $ s
+            lift . sendFile . fromText . fromString $ s
 
         String t ->
             lift . writeText $ t
         [$p|r local-address|] =:: string (fromBS $ rqLocalAddr r)
         [$p|r local-hostname|] =:: string (fromBS $ rqLocalHostname r)
 
-        ([$p|r secure?|] =::) =<< bool (rqIsSecure r)
+        [$p|r secure?|] =:: Boolean (rqIsSecure r)
 
         headers <- list =<< forM (M.toList (headers r)) (\(n, vs) ->
             dispatch $