Commit 69a1054e authored by bbr's avatar bbr
Browse files

last repair for showQTerm

strings are now also nicely showed as qualified terms
parent d6e34c79
......@@ -34,6 +34,9 @@ class (BaseCurry a,Show a,Read a) => Curry a where
showQ :: Int -> a -> String -> String
showQ = showsPrec
showQList :: [a] -> String -> String
showQList = showQStandardList
-- generic programming
--toC_Term :: HNFMode -> State -> a -> C_Data
--fromC_Term :: C_Data -> a
......@@ -424,6 +427,44 @@ instance Generate a => BaseCurry (Prim a) where
suspCont (PrimSusp _ x) = x
instance (BaseCurry t0) => BaseCurry (DataPrelude.List t0) where
nf f ((DataPrelude.:<) x1 x2) state0 = Curry.nfCTC(\ v1 state1 -> Curry.nfCTC(\ v2 state2 -> f((DataPrelude.:<)(v1)(v2))(state2))(x2)(state1))(x1)(state0)
nf f x st = f(x)(st)
gnf f ((DataPrelude.:<) x1 x2) state0 = Curry.gnfCTC(\ v1 state1 -> Curry.gnfCTC(\ v2 state2 -> f((DataPrelude.:<)(v1)(v2))(state2))(x2)(state1))(x1)(state0)
gnf f x st = f(x)(st)
free _ = Curry.orsCTC([DataPrelude.List,(DataPrelude.:<)(Curry.free(()))(Curry.free(()))])
pattern _ = Curry.orsCTC([DataPrelude.List,(DataPrelude.:<)(Curry.freeIORef(()))(Curry.freeIORef(()))])
failed = DataPrelude.ListFail
freeVar = DataPrelude.ListFreeVar
branching = DataPrelude.ListOr
suspend = DataPrelude.ListSusp
consKind (DataPrelude.ListFreeVar _) = Curry.Free
consKind (DataPrelude.ListOr _ _) = Curry.Branching
consKind (DataPrelude.ListFail _) = Curry.Failed
consKind (DataPrelude.ListSusp _ _) = Curry.Suspended
consKind _ = Curry.Val
exceptions (DataPrelude.ListFail x) = x
freeVarRef (DataPrelude.ListFreeVar x) = x
orRef (DataPrelude.ListOr x _) = x
branches (DataPrelude.ListOr _ x) = x
suspRef (DataPrelude.ListSusp x _) = x
suspCont (DataPrelude.ListSusp _ x) = x
-----------------------------------------------------------------
-- converting between curry and haskell
-----------------------------------------------------------------
......@@ -667,43 +708,6 @@ instance Generate Float where
-- external Curry instances
-----------------------------------------------------------------
instance (BaseCurry t0) => BaseCurry (DataPrelude.List t0) where
nf f ((DataPrelude.:<) x1 x2) state0 = Curry.nfCTC(\ v1 state1 -> Curry.nfCTC(\ v2 state2 -> f((DataPrelude.:<)(v1)(v2))(state2))(x2)(state1))(x1)(state0)
nf f x st = f(x)(st)
gnf f ((DataPrelude.:<) x1 x2) state0 = Curry.gnfCTC(\ v1 state1 -> Curry.gnfCTC(\ v2 state2 -> f((DataPrelude.:<)(v1)(v2))(state2))(x2)(state1))(x1)(state0)
gnf f x st = f(x)(st)
free _ = Curry.orsCTC([DataPrelude.List,(DataPrelude.:<)(Curry.free(()))(Curry.free(()))])
pattern _ = Curry.orsCTC([DataPrelude.List,(DataPrelude.:<)(Curry.freeIORef(()))(Curry.freeIORef(()))])
failed = DataPrelude.ListFail
freeVar = DataPrelude.ListFreeVar
branching = DataPrelude.ListOr
suspend = DataPrelude.ListSusp
consKind (DataPrelude.ListFreeVar _) = Curry.Free
consKind (DataPrelude.ListOr _ _) = Curry.Branching
consKind (DataPrelude.ListFail _) = Curry.Failed
consKind (DataPrelude.ListSusp _ _) = Curry.Suspended
consKind _ = Curry.Val
exceptions (DataPrelude.ListFail x) = x
freeVarRef (DataPrelude.ListFreeVar x) = x
orRef (DataPrelude.ListOr x _) = x
branches (DataPrelude.ListOr _ x) = x
suspRef (DataPrelude.ListSusp x _) = x
suspCont (DataPrelude.ListSusp _ x) = x
instance (Curry t0) => Curry (DataPrelude.List t0) where
strEq DataPrelude.List DataPrelude.List st = ExternalInstancesPrelude.strEqSuccess
strEq ((DataPrelude.:<) x1 x2) ((DataPrelude.:<) y1 y2) st = ExternalInstancesPrelude.concAnd(ExternalInstancesPrelude.genStrEq(x1)(y1)(st))(ExternalInstancesPrelude.genStrEq(x2)(y2)(st))(st)
......@@ -721,30 +725,7 @@ instance (Curry t0) => Curry (DataPrelude.List t0) where
typeName _ = "[]"
showQ = showsPrecList (showQ 0) showQStandardList
{-
instance (Curry a) => Curry (IOVal a) where
strEq (IOVal x1) (IOVal y1) = op_61_58_61(x1)(y1)
strEq x0 _ = strEqFail(typeName(x0))
eq (IOVal x1) (IOVal y1) = op_61_61(x1)(y1)
eq _ _ = C_False
--subst store (IOVal x1) = IOVal(subst(store)(x1))
--subst store (IOValFreeVar r) = fetch(store)(r)
typeName _ = "IOVal"
--toC_Term mode store (IOVal x1) = C_Data(C_Int((1::Integer)))((:<)(C_Char('I'))((:<)(C_Char('O'))((:<)(C_Char('V'))((:<)(C_Char('a'))((:<)(C_Char('l'))(List))))))((:<)(ctcStore(mode)(toC_Term(mode))(store)(x1))(List))
--toC_Term _ _ (IOValFreeVar r) = C_Free(C_Int(Prelude.toInteger(r)))
--fromC_Term (C_Data (C_Int (1::Integer)) _ ((:<) x1 List)) = IOVal(fromC_Term(x1))
--fromC_Term (C_Data (C_IntFreeVar _) ((:<) (C_Char 'I') ((:<) (C_Char 'O') ((:<) (C_Char 'V') ((:<) (C_Char 'a') ((:<) (C_Char 'l') List))))) ((:<) x1 List)) = IOVal(fromC_Term(x1))
--fromC_Term (C_Free (C_Int r)) = IOValFreeVar(Prelude.fromInteger(r))
-}
showQ = showsPrecList (showQ 0) showQList
instance Curry C_Four where
strEq C_F0 C_F0 _ = strEqSuccess
......@@ -827,6 +808,9 @@ instance Curry C_Char where
foldCurry _ c (C_Char _) _ = c
foldCurry f c (SearchChar f0 f1 f2 f3) st = f f0 (f f1 (f f2 (f f3 c st)st)st)st
typeName _ = "Char"
showQList = showList
--toC_Term _ _ (C_Char c) = C_Data (C_Int (toInteger (ord c))) (toCurry (show c)) List
--toC_Term _ _ (C_CharFreeVar r) = C_Free(C_Int(Prelude.toInteger(r)))
......@@ -835,7 +819,6 @@ instance Curry C_Char where
--fromC_Term (C_Data (C_IntFreeVar _) name List) = C_Char (read (fromCurry name))
--fromC_Term (C_Free (C_Int r)) = C_CharFreeVar(Prelude.fromInteger(r))
typeName _ = "Char"
instance (Generate a,Show a,Read a,Eq a) => Curry (Prim a) where
strEq x@(PrimValue v1) (PrimValue v2) _
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment