i do not know result too,
this is why i need to compile and run it to show this magic result
*Main Data.Foldable> foldr ((map (+1.2) [1,2]) . (map (+1.4) [2,3])) 1.0
<interactive>:18:1:
Ambiguous occurrence `foldr'
It could refer to either `Data.List.foldr',
imported from `Data.List' at trees3a.hs:1:1-16
(and originally defined in `GHC.Base')
or `Data.Foldable.foldr', imported from `Data.Foldable'
*Main Data.Foldable> foldr ((map (+1.2) [1,2]) . (map (+1.4) [2,3])) [1.0]
<interactive>:19:1:
Ambiguous occurrence `foldr'
It could refer to either `Data.List.foldr',
imported from `Data.List' at trees3a.hs:1:1-16
(and originally defined in `GHC.Base')
or `Data.Foldable.foldr', imported from `Data.Foldable'
*Main Data.Foldable> Data.Foldable.foldr ((map (+1.2) [1,2]) . (map (+1.4) [2,3])) [1.0]
<interactive>:20:23:
Couldn't match expected type `b0 -> [t1] -> [t1]'
with actual type `[b1]'
In the return type of a call of `map'
Probable cause: `map' is applied to too many arguments
In the first argument of `(.)', namely `(map (+ 1.2) [1, 2])'
In the first argument of `Data.Foldable.foldr', namely
`((map (+ 1.2) [1, 2]) . (map (+ 1.4) [2, 3]))'
<interactive>:20:44:
Couldn't match expected type `a0 -> b0' with actual type `[b2]'
In the return type of a call of `map'
Probable cause: `map' is applied to too many arguments
In the second argument of `(.)', namely `(map (+ 1.4) [2, 3])'
In the first argument of `Data.Foldable.foldr', namely
`((map (+ 1.2) [1, 2]) . (map (+ 1.4) [2, 3]))'
*Main Data.Foldable> Data.Foldable.foldr ((map (+1.2) [1,2]) . (map (+1.4) [2,3])) [1.0,2.0]
<interactive>:21:23:
Couldn't match expected type `b0 -> [t1] -> [t1]'
with actual type `[b1]'
In the return type of a call of `map'
Probable cause: `map' is applied to too many arguments
In the first argument of `(.)', namely `(map (+ 1.2) [1, 2])'
In the first argument of `Data.Foldable.foldr', namely
`((map (+ 1.2) [1, 2]) . (map (+ 1.4) [2, 3]))'
<interactive>:21:44:
Couldn't match expected type `a0 -> b0' with actual type `[b2]'
In the return type of a call of `map'
Probable cause: `map' is applied to too many arguments
In the second argument of `(.)', namely `(map (+ 1.4) [2, 3])'
In the first argument of `Data.Foldable.foldr', namely
`((map (+ 1.2) [1, 2]) . (map (+ 1.4) [2, 3]))'
*Main Data.Foldable> foldr ((map (+1.2) [1,2]) . (map (+1.4) [2,3])) [1.0,2.0]
<interactive>:22:1:
Ambiguous occurrence `foldr'
It could refer to either `Data.List.foldr',
imported from `Data.List' at trees3a.hs:1:1-16
(and originally defined in `GHC.Base')
or `Data.Foldable.foldr', imported from `Data.Foldable'
*Main Data.Foldable> foldr ((map (+1.2) [1,2]) . (map (+1.4) [2,3])) [1.0,2.0]
On Wednesday, July 27, 2016 at 3:39:24 PM UTC+8, Mark Carroll wrote:
On 27 Jul 2016, Ho Yeung Lee wrote:
import Data.Foldable
let aa = map (+1.2) [1,2]
let bb = map (+1.4) [2,3]
i find foldr, but how to use it for above two map?
I am not sure for what result you are hoping, but perhaps "zip" can
help?
-- Mark
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)