Featured post
haskell - Understanding a Complicated Type Signature -
i need understanding type signature thrist package.
import prelude hiding ((.), id) import control.category import data.monoid import control.arrow import control.monad foldlthirst :: (forall j k . (a +> j) -> (j ~> k) -> (a +> k)) -> (a +> b) -> thrist (~>) b c -> (a +> c)
i confused several things.
first +> , ~> symbols? documented , called?
but confusion stop there. realize quantification describing threading of types of thrist, not sure if describing relationship holds first argument, or whole function, or knows...
in othercases have seen existential quantification, phrase ends period, here ends ->, significant?
first +> , ~> symbols? documented , called?
they're infix identifiers, if used them name of function. same token, being equivalent lowercase identifiers (in contrast operators beginning :
equivalent upper-case alphanumeric identifiers), in type signature they're type variables. in other words, it's equivalent this:
(forall j k . (f j) -> (g j k) -> (f k)) -> etc . . .
but confusion stop there. realize quantification describing threading of types of thrist, not sure if describing relationship holds first argument, or whole function, or knows...
explicit quantifiers scoped within enclosing parentheses, or end of expression. in case, describe first argument, because type variables introduced in scope argument.
in case, means function given first argument must polymorphic in types. example, function type signature starts (a -> a) -> ...
given not
first argument, unifying a
bool
. in contrast, if type signature started (forall a. -> a) -> ...
require function works possible types a
, such function being id
.
- Get link
- X
- Other Apps
Comments
Post a Comment