Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

Anonymous recursion. Why doesnt compile?

Language: Layout:
+ ] Compiler args + ] Show input
Compilation time: 0.23 sec, absolute service time: 0,38 sec  
edit mode |  history  | discussion
Error(s):
source_file.hs:10:66:
    Occurs check: cannot construct the infinite type:
      r1 ~ a -> a -> r1 -> a
    Expected type: a -> a -> r1 -> a
      Actual type: a -> a -> (a -> a -> r1 -> a) -> a
    Relevant bindings include
      z :: a -> a -> (a -> a -> r1 -> a) -> a
        (bound at source_file.hs:10:32)
      y :: a
        (bound at source_file.hs:10:26)
      x :: a
        (bound at source_file.hs:10:20)
      g :: b -> b -> a
        (bound at source_file.hs:10:1)
    In the third argument of ‘z’, namely ‘(z)’
    In the expression: z (x - 1) (y + (x ** 2)) (z)

source_file.hs:10:131:
    Occurs check: cannot construct the infinite type:
      r1 ~ a -> a -> r1 -> a
    Relevant bindings include
      z :: a -> a -> r1 -> a
        (bound at source_file.hs:10:97)
      y :: a
        (bound at source_file.hs:10:91)
      x :: a
        (bound at source_file.hs:10:85)
      g :: b -> b -> a
        (bound at source_file.hs:10:1)
    In the third argument of ‘z’, namely ‘(z)’
    In the expression: z (x - 1) (y + (x ** 2)) (z)

source_file.hs:11:8:
    No instance for (Show r0) arising from a use of ‘print’
    The type variable ‘r0’ is ambiguous
    Note: there are several potential instances:
      instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
      instance (Integral a, Show a) => Show (GHC.Real.Ratio a)
        -- Defined in ‘GHC.Real’
      instance Show Ordering -- Defined in ‘GHC.Show’
      ...plus 23 others
    In the expression: print
    In the expression: print $ g (3) (0)
    In an equation for ‘main’: main = print $ g (3) (0)

        

    
                
λ
.NET NoSQL database for rapid development