1 Aug 2007 03:46
[GHC] #1571: type of synthesize in Data.Generics.Schemes is too restrictive
GHC <trac <at> galois.com>
2007-08-01 01:46:27 GMT
2007-08-01 01:46:27 GMT
#1571: type of synthesize in Data.Generics.Schemes is too restrictive
----------------------------------+-----------------------------------------
Reporter: sciolizer <at> gmail.com | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 6.6.1
Severity: normal | Keywords: synthesize,syb
Difficulty: Easy (1 hr) | Os: Linux
Testcase: | Architecture: x86
----------------------------------+-----------------------------------------
The type of the synthesize function in Data.Generics.Schemes is
unnecessarily restrictive. It's current type is
synthesize :: s -> (s -> s -> s) -> GenericQ (s -> s) -> GenericQ s
but it would be more useful if it were
synthesize :: s -> (t -> s -> s) -> GenericQ (s -> t) -> GenericQ t
Below is a contrived example demonstrating why one might want the more
liberal type.
module Main where
import Data.Generics
synthesize' :: s -> (t -> s -> s) -> GenericQ (s -> t) -> GenericQ t
synthesize' z o f x = f x (foldr o z (gmapQ (synthesize' z o f) x))
-- The toTree function fails to type if synthesize' is replaced
(Continue reading)
RSS Feed