summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2015-02-12 16:09:33 +0000
committerhallgren <hallgren@chalmers.se>2015-02-12 16:09:33 +0000
commit2b8fe8ea7a4f40445889b80bd7f737d0078e7598 (patch)
tree0ed1b5587b43da48867637bacc56c3b37fc66dad
parentefb1b540f43a71e33673f0f6a02fcc39e8604c74 (diff)
PGF.Haskell: adding operators for selections from tables
-rw-r--r--src/runtime/haskell/PGF/Haskell.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/runtime/haskell/PGF/Haskell.hs b/src/runtime/haskell/PGF/Haskell.hs
index d77395518..81e8cffaa 100644
--- a/src/runtime/haskell/PGF/Haskell.hs
+++ b/src/runtime/haskell/PGF/Haskell.hs
@@ -3,6 +3,7 @@
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-}
module PGF.Haskell where
import Control.Applicative((<$>),(<*>))
+import Control.Monad(join)
import Data.Char(toUpper)
import Data.List(isPrefixOf)
import qualified Data.Map as M
@@ -65,4 +66,10 @@ to_R_s r = R_s (proj_s r)
infixr 5 +++
-xs +++ ys = (++) <$> xs <*> ys \ No newline at end of file
+-- | Concatenation with variants
+xs +++ ys = (++) <$> xs <*> ys
+
+-- | Selection from tables with variants
+t ! p = join (t p)
+t !$ p = join (t <$> p)
+t !* p = join (t <*> p)