• is applied to too many type arguments In the type signature for

    From meInvent bbird@21:1/5 to All on Tue Jul 26 00:02:34 2016
    [1 of 1] Compiling Main ( trees3a.hs, interpreted )

    trees3a.hs:79:25:
    `Operation' is applied to too many type arguments
    In the type signature for `getAllTreesFromList':
    getAllTreesFromList :: (Operation b, Integral a) =>
    [b] -> [a] -> [Mree a]
    Failed, modules loaded: none.



    data Operation
    = MA
    | MB
    deriving Show

    getAllTreesFromList :: (Operation b, Double a) => [b] -> [a] -> [Mree a] getAllTreesFromList ys [] = []
    getAllTreesFromList ys [x] = return $ Meaf x
    getAllTreesFromList ys xs = do
    (left, right) <- splits xs
    guard $ not (null left) && not (null right)
    leftT <- getAllTreesFromList ys left
    rightT <- getAllTreesFromList ys right
    op <- ys
    return $ Mode leftT op rightT

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mark Carroll@21:1/5 to meInvent bbird on Tue Jul 26 09:17:45 2016
    On 26 Jul 2016, meInvent bbird wrote:

    data Operation
    = MA
    | MB
    deriving Show

    getAllTreesFromList :: (Operation b, Double a) => [b] -> [a] -> [Mree a]

    Between the round parentheses one mentions typeclasses, not types.
    Perhaps you meant something like,

    getAllTreesFromList :: [Operation] -> [Double] -> [Mree a]

    -- Mark

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)