Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. on f g = curry $ (. bimap g g) $ uncurry f
  2.  
  3. on :: forall (co :: * -> Constraint) a1 a2 b c .
  4. (co a1, co a2) =>
  5. (b -> b -> c)
  6. -> (forall a . co a => a -> b)
  7. -> a1 -> a2 -> c
  8.  
  9. > :t (+) `on` toInteger`
  10.  
  11. • Couldn't match type ‘c’ with ‘Integer’
  12. ‘c’ is untouchable
  13. inside the constraints: co a
  14. bound by a type expected by the context:
  15. forall a. co a => a -> c
  16. at <interactive>:1:1-18
  17. ‘c’ is a rigid type variable bound by
  18. the inferred type of it :: (co a1, co a2, Num c) => a1 -> a2 -> c
  19. at <interactive>:1:1
  20. Possible fix: add a type signature for ‘it’
  21. Expected type: a -> c
  22. Actual type: a -> Integer
  23. • In the second argument of ‘on’, namely ‘toInteger’
  24. In the expression: (+) `on` toInteger
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement