then i remembered that is ->
then got following error
replacewithoriginalformula :: Mree [Double] -> [([Double], (Mree [Double], Double))] -> [Double]
replacewithoriginalformula (Meaf x) amap = findformulawithresult x amap replacewithoriginalformula (Mode l MA r) amap = Mode (replacewithoriginalformula l amap) MA (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MB r) amap = Mode (replacewithoriginalformula l amap) MB (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MC r) amap = Mode (replacewithoriginalformula l amap) MC (replacewithoriginalformula r amap)
Prelude> :l trees3.hs
[1 of 1] Compiling Main ( trees3.hs, interpreted )
trees3.hs:53:68:
Couldn't match type `Mree [Double]' with `[Double]'
Expected type: [([Double], ([Double], Double))]
Actual type: [([Double], (Mree [Double], Double))]
In the second argument of `findformulawithresult', namely `amap'
In the expression: findformulawithresult x amap
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Meaf x) amap
= findformulawithresult x amap
trees3.hs:54:49:
Couldn't match expected type `[Double]' with actual type `Mree x0'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MA r) amap
= Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:54:55:
Couldn't match expected type `Mree x0' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:54:94:
Couldn't match expected type `Mree x0' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:55:49:
Couldn't match expected type `[Double]' with actual type `Mree x1'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MB r) amap
= Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:55:55:
Couldn't match expected type `Mree x1' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:55:94:
Couldn't match expected type `Mree x1' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:56:49:
Couldn't match expected type `[Double]' with actual type `Mree x2'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MC r) amap
= Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
trees3.hs:56:55:
Couldn't match expected type `Mree x2' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
trees3.hs:56:94:
Couldn't match expected type `Mree x2' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
Failed, modules loaded: none.
On Tuesday, July 19, 2016 at 2:28:15 PM UTC+8, meInvent bbird wrote:
i had tried comma and bracket also can not compile
replacewithoriginalformula :: Mree [Double], [([Double], (Mree [Double], Double))] -> [Double]
trees3.hs:52:44: parse error on input `,'
replacewithoriginalformula :: (Mree [Double]) [([Double], (Mree [Double], Double))] -> [Double]
Prelude> :l trees3.hs
[1 of 1] Compiling Main ( trees3.hs, interpreted )
trees3.hs:52:31:
`Mree' is applied to too many type arguments
In the type signature for `replacewithoriginalformula':
replacewithoriginalformula :: Mree [Double] [([Double],
(Mree [Double], Double))]
-> [Double]
Failed, modules loaded: none.
original code
*Main> :t bb1map
bb1map :: [([Double], (Mree [Double], Double))]
fst (fromJust (Map.lookup [0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0] (Map.fromList bb1map)))
then change to function
let findformulawithresult rr resultmap = fst (fromJust (Map.lookup rr (Map.fromList resultmap)))
findformulawithresult rr resultmap = fst (fromJust (Map.lookup rr (Map.fromList resultmap)))
replacewithoriginalformula :: Mree [Double], [([Double], (Mree [Double], Double))] -> [Double]
replacewithoriginalformula (Meaf x) amap = findformulawithresult x amap replacewithoriginalformula (Mode l MA r) amap = Mode (replacewithoriginalformula l amap) MA (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MB r) amap = Mode (replacewithoriginalformula l amap) MB (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MC r) amap = Mode (replacewithoriginalformula l amap) MC (replacewithoriginalformula r amap)
this time i give explicit type signature to findformulawithresult
still have error
Mode (Meaf [0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0]) MB (Meaf [0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0])
data Mree x
= Meaf x
| Mode (Mree x) Operation (Mree x)
deriving Show
findformulawithresult :: [Double] -> [([Double], (Mree [Double], Double))] -> Mree [Double]
findformulawithresult rr resultmap = fst (fromJust (Map.lookup rr (Map.fromList resultmap)))
Prelude> :l trees3.hs
[1 of 1] Compiling Main ( trees3.hs, interpreted )
trees3.hs:55:44:
Couldn't match expected type `[Double]'
with actual type `Mree [Double]'
In the return type of a call of `findformulawithresult'
In the expression: findformulawithresult x amap
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Meaf x) amap
= findformulawithresult x amap
trees3.hs:56:49:
Couldn't match expected type `[Double]' with actual type `Mree x0'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MA r) amap
= Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:56:55:
Couldn't match expected type `Mree x0' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:56:94:
Couldn't match expected type `Mree x0' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:57:49:
Couldn't match expected type `[Double]' with actual type `Mree x1'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MB r) amap
= Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:57:55:
Couldn't match expected type `Mree x1' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:57:94:
Couldn't match expected type `Mree x1' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:58:49:
Couldn't match expected type `[Double]' with actual type `Mree x2'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MC r) amap
= Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
trees3.hs:58:55:
Couldn't match expected type `Mree x2' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
trees3.hs:58:94:
Couldn't match expected type `Mree x2' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
Failed, modules loaded: none.
On Tuesday, July 19, 2016 at 5:03:11 PM UTC+8, meInvent bbird wrote:
then i remembered that is ->
then got following error
replacewithoriginalformula :: Mree [Double] -> [([Double], (Mree [Double], Double))] -> [Double]
replacewithoriginalformula (Meaf x) amap = findformulawithresult x amap replacewithoriginalformula (Mode l MA r) amap = Mode (replacewithoriginalformula l amap) MA (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MB r) amap = Mode (replacewithoriginalformula l amap) MB (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MC r) amap = Mode (replacewithoriginalformula l amap) MC (replacewithoriginalformula r amap)
Prelude> :l trees3.hs
[1 of 1] Compiling Main ( trees3.hs, interpreted )
trees3.hs:53:68:
Couldn't match type `Mree [Double]' with `[Double]'
Expected type: [([Double], ([Double], Double))]
Actual type: [([Double], (Mree [Double], Double))]
In the second argument of `findformulawithresult', namely `amap'
In the expression: findformulawithresult x amap
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Meaf x) amap
= findformulawithresult x amap
trees3.hs:54:49:
Couldn't match expected type `[Double]' with actual type `Mree x0'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MA r) amap
= Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:54:55:
Couldn't match expected type `Mree x0' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:54:94:
Couldn't match expected type `Mree x0' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MA
(replacewithoriginalformula r amap)
trees3.hs:55:49:
Couldn't match expected type `[Double]' with actual type `Mree x1'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MB r) amap
= Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:55:55:
Couldn't match expected type `Mree x1' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:55:94:
Couldn't match expected type `Mree x1' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MB
(replacewithoriginalformula r amap)
trees3.hs:56:49:
Couldn't match expected type `[Double]' with actual type `Mree x2'
In the return type of a call of `Mode'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
In an equation for `replacewithoriginalformula':
replacewithoriginalformula (Mode l MC r) amap
= Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
trees3.hs:56:55:
Couldn't match expected type `Mree x2' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the first argument of `Mode', namely
`(replacewithoriginalformula l amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
trees3.hs:56:94:
Couldn't match expected type `Mree x2' with actual type `[Double]'
In the return type of a call of `replacewithoriginalformula'
In the third argument of `Mode', namely
`(replacewithoriginalformula r amap)'
In the expression:
Mode
(replacewithoriginalformula l amap)
MC
(replacewithoriginalformula r amap)
Failed, modules loaded: none.
On Tuesday, July 19, 2016 at 2:28:15 PM UTC+8, meInvent bbird wrote:
i had tried comma and bracket also can not compile
replacewithoriginalformula :: Mree [Double], [([Double], (Mree [Double], Double))] -> [Double]
trees3.hs:52:44: parse error on input `,'
replacewithoriginalformula :: (Mree [Double]) [([Double], (Mree [Double], Double))] -> [Double]
Prelude> :l trees3.hs
[1 of 1] Compiling Main ( trees3.hs, interpreted )
trees3.hs:52:31:
`Mree' is applied to too many type arguments
In the type signature for `replacewithoriginalformula':
replacewithoriginalformula :: Mree [Double] [([Double],
(Mree [Double], Double))]
-> [Double]
Failed, modules loaded: none.
original code
*Main> :t bb1map
bb1map :: [([Double], (Mree [Double], Double))]
fst (fromJust (Map.lookup [0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0] (Map.fromList bb1map)))
then change to function
let findformulawithresult rr resultmap = fst (fromJust (Map.lookup rr (Map.fromList resultmap)))
findformulawithresult rr resultmap = fst (fromJust (Map.lookup rr (Map.fromList resultmap)))
replacewithoriginalformula :: Mree [Double], [([Double], (Mree [Double], Double))] -> [Double]
replacewithoriginalformula (Meaf x) amap = findformulawithresult x amap replacewithoriginalformula (Mode l MA r) amap = Mode (replacewithoriginalformula l amap) MA (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MB r) amap = Mode (replacewithoriginalformula l amap) MB (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MC r) amap = Mode (replacewithoriginalformula l amap) MC (replacewithoriginalformula r amap)
i had tried comma and bracket also can not compile
replacewithoriginalformula :: Mree [Double], [([Double], (Mree [Double], Double))] -> [Double]
trees3.hs:52:44: parse error on input `,'
replacewithoriginalformula :: (Mree [Double]) [([Double], (Mree [Double], Double))] -> [Double]
Prelude> :l trees3.hs
[1 of 1] Compiling Main ( trees3.hs, interpreted )
trees3.hs:52:31:
`Mree' is applied to too many type arguments
In the type signature for `replacewithoriginalformula':
replacewithoriginalformula :: Mree [Double] [([Double],
(Mree [Double], Double))]
-> [Double]
Failed, modules loaded: none.
original code
*Main> :t bb1map
bb1map :: [([Double], (Mree [Double], Double))]
fst (fromJust (Map.lookup [0.0,1.0,0.0,1.0,0.0,1.0,0.0,1.0] (Map.fromList bb1map)))
then change to function
let findformulawithresult rr resultmap = fst (fromJust (Map.lookup rr (Map.fromList resultmap)))
findformulawithresult rr resultmap = fst (fromJust (Map.lookup rr (Map.fromList resultmap)))
replacewithoriginalformula :: Mree [Double], [([Double], (Mree [Double], Double))] -> [Double]
replacewithoriginalformula (Meaf x) amap = findformulawithresult x amap replacewithoriginalformula (Mode l MA r) amap = Mode (replacewithoriginalformula l amap) MA (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MB r) amap = Mode (replacewithoriginalformula l amap) MB (replacewithoriginalformula r amap)
replacewithoriginalformula (Mode l MC r) amap = Mode (replacewithoriginalformula l amap) MC (replacewithoriginalformula r amap)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 113 |
Nodes: | 8 (1 / 7) |
Uptime: | 125:20:55 |
Calls: | 2,501 |
Files: | 8,692 |
Messages: | 1,924,351 |