summaryrefslogtreecommitdiff
path: root/src/GF
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2007-09-25 05:55:49 +0000
committerkr.angelov <kr.angelov@gmail.com>2007-09-25 05:55:49 +0000
commit286851b7c0628ec9aaecf6d41bd56d13218f53cd (patch)
tree62c34d6dabd6d1b7d75ec25dcae734a63c23b0f8 /src/GF
parentc6c7557b13091116f66884c0d6105dca0fd33df3 (diff)
remove the dependency to GF.Data.Operations from GF Embed API
Diffstat (limited to 'src/GF')
-rw-r--r--src/GF/Canon/GFCC/GenGFCC.hs7
-rw-r--r--src/GF/Infra/Print.hs3
-rw-r--r--src/GF/Infra/PrintClass.hs5
3 files changed, 9 insertions, 6 deletions
diff --git a/src/GF/Canon/GFCC/GenGFCC.hs b/src/GF/Canon/GFCC/GenGFCC.hs
index f1d4e8923..cd15ae9cf 100644
--- a/src/GF/Canon/GFCC/GenGFCC.hs
+++ b/src/GF/Canon/GFCC/GenGFCC.hs
@@ -2,7 +2,7 @@ module GF.Canon.GFCC.GenGFCC where
import GF.Canon.GFCC.DataGFCC
import GF.Canon.GFCC.AbsGFCC
-import GF.Data.Operations
+
import qualified Data.Map as M
import System.Random
@@ -26,6 +26,11 @@ generate gfcc cat = concatMap (\i -> gener i cat) [0..]
Tr _ [] -> 1
Tr _ ts -> maximum (map depth ts) + 1
+combinations :: [[a]] -> [[a]]
+combinations t = case t of
+ [] -> [[]]
+ aa:uu -> [a:u | a <- aa, u <- combinations uu]
+
-- generate an infinite list of trees randomly
generateRandom :: StdGen -> GFCC -> CId -> [Exp]
generateRandom gen gfcc cat = genTrees (randomRs (0.0, 1.0) gen) cat where
diff --git a/src/GF/Infra/Print.hs b/src/GF/Infra/Print.hs
index c4a310c29..17f2c2188 100644
--- a/src/GF/Infra/Print.hs
+++ b/src/GF/Infra/Print.hs
@@ -121,4 +121,7 @@ instance Print CFFun where
instance Print Exp where
prt = P.printTree
+instance Print a => Print (Err a) where
+ prt (Ok a) = prt a
+ prt (Bad str) = str
diff --git a/src/GF/Infra/PrintClass.hs b/src/GF/Infra/PrintClass.hs
index 93d7366b6..5e94984a6 100644
--- a/src/GF/Infra/PrintClass.hs
+++ b/src/GF/Infra/PrintClass.hs
@@ -1,7 +1,6 @@
module GF.Infra.PrintClass where
import Data.List (intersperse)
-import GF.Data.Operations (Err(..))
class Print a where
prt :: a -> String
@@ -50,7 +49,3 @@ instance Print Integer where
instance Print a => Print (Maybe a) where
prt (Just a) = prt a
prt Nothing = "Nothing"
-
-instance Print a => Print (Err a) where
- prt (Ok a) = prt a
- prt (Bad str) = str