Verified Commit f4974f8f authored by Camil Staps's avatar Camil Staps 🙂

Add test cases and a fix for classes with complex contexts

parent 39e6932a
......@@ -299,11 +299,11 @@ function highlightFunction(func, callback, start) {
[/(where)/, ['keyword']],
[/([a-z][\w`]*)/, ['typevar']],
[/(~)/, ['punctuation']],
[/(\|)/, ['punctuation'], 'classContext'],
[/(\|)/, ['punctuation'], 'pop;classContext'],
[/(::)/, ['punctuation'], 'pop;type']
],
classContext: [
[/(where)/, ['keyword']],
[/(where)/, ['keyword'], 'pop'],
[/(\s+)/, ['whitespace']],
[/(,)/, ['punctuation']],
[/(\S+)(\{\|)/, ['generic', 'punctuation'], 'classGeneric'],
......@@ -315,9 +315,9 @@ function highlightFunction(func, callback, start) {
[/([*>-]+\|\})/, ['punctuation'], 'classContextType']
],
classContextType: [
[/(where)/, ['keyword']],
[/(where)/, ['keyword'], 'pop:2'],
[/(\s+)/, ['whitespace']],
[/([,&])/, ['punctuation'], 'classContext'],
[/([,&])/, ['punctuation'], 'pop'],
[/([^\s,]+)/, ['typevar']]
],
derive: [
......
Function
-----
class Applicative f | Functor f
where
pure :: a -> f a
(<*>) infixl 4 :: !(f (a -> b)) (f a) -> f b
-----
keyword class
whitespace
classname Applicative
whitespace
typevar f
whitespace
punctuation |
whitespace
classname Functor
whitespace
typevar f
whitespace \n
keyword where
whitespace \n
funcname pure
whitespace
punctuation ::
whitespace
typevar a
whitespace
punctuation ->
whitespace
typevar f
whitespace
typevar a
whitespace \n
punctuation (
funcname <*>
punctuation )
whitespace
keyword infixl
whitespace
keyword 4
whitespace
punctuation ::
whitespace
punctuation !(
typevar f
whitespace
punctuation (
typevar a
whitespace
punctuation ->
whitespace
typevar b
punctuation ))
whitespace
punctuation (
typevar f
whitespace
typevar a
punctuation )
whitespace
punctuation ->
whitespace
typevar f
whitespace
typevar b
Function
-----
class Monad m | Applicative m where
bind :: !(m a) (a -> m b) -> m b
(>>=) infixl 1 :: (m a) (a -> m b) -> m b | Monad m
(>>=) ma a2mb :== bind ma a2mb
(`b`) infixl 1 :: (m a) (a -> m b) -> m b | Monad m
(`b`) ma a2mb :== bind ma a2mb
(>>|) infixl 1 :: (m a) (m b) -> m b | Monad m
(>>|) ma mb :== ma >>= (\_ -> mb)
(=<<) infixr 1 :: (a -> m b) (m a) -> m b | Monad m
(=<<) f x :== x >>= f
-----
keyword class
whitespace
classname Monad
whitespace
typevar m
whitespace
punctuation |
whitespace
classname Applicative
whitespace
typevar m
whitespace
keyword where
whitespace \n\n
funcname bind
whitespace
punctuation ::
whitespace
punctuation !(
typevar m
whitespace
typevar a
punctuation )
whitespace
punctuation (
typevar a
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
punctuation )
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
whitespace \n
punctuation (
funcname >>=
punctuation )
whitespace
keyword infixl
whitespace
keyword 1
whitespace
punctuation ::
whitespace
punctuation (
typevar m
whitespace
typevar a
punctuation )
whitespace
punctuation (
typevar a
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
punctuation )
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
whitespace
punctuation |
whitespace
classname Monad
whitespace
typevar m
whitespace \n
punctuation (
funcname >>=
punctuation )
whitespace
macroargument ma
whitespace
macroargument a2mb
whitespace
punctuation :==
whitespace
funcname funcname-onlyused bind
whitespace
macroargumentinrhs ma
whitespace
macroargumentinrhs a2mb
whitespace \n
punctuation (
funcname `b`
punctuation )
whitespace
keyword infixl
whitespace
keyword 1
whitespace
punctuation ::
whitespace
punctuation (
typevar m
whitespace
typevar a
punctuation )
whitespace
punctuation (
typevar a
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
punctuation )
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
whitespace
punctuation |
whitespace
classname Monad
whitespace
typevar m
whitespace \n
punctuation (
funcname `b`
punctuation )
whitespace
macroargument ma
whitespace
macroargument a2mb
whitespace
punctuation :==
whitespace
funcname funcname-onlyused bind
whitespace
macroargumentinrhs ma
whitespace
macroargumentinrhs a2mb
whitespace \n
punctuation (
funcname >>|
punctuation )
whitespace
keyword infixl
whitespace
keyword 1
whitespace
punctuation ::
whitespace
punctuation (
typevar m
whitespace
typevar a
punctuation )
whitespace
punctuation (
typevar m
whitespace
typevar b
punctuation )
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
whitespace
punctuation |
whitespace
classname Monad
whitespace
typevar m
whitespace \n
punctuation (
funcname >>|
punctuation )
whitespace
macroargument ma
whitespace
macroargument mb
whitespace
punctuation :==
whitespace
macroargumentinrhs ma
whitespace
punctuation >>=
whitespace
punctuation (\
argument argument-wildcard _
whitespace
punctuation ->
whitespace
macroargumentinrhs mb
punctuation )
whitespace \n
punctuation (
funcname =<<
punctuation )
whitespace
keyword infixr
whitespace
keyword 1
whitespace
punctuation ::
whitespace
punctuation (
typevar a
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
punctuation )
whitespace
punctuation (
typevar m
whitespace
typevar a
punctuation )
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
whitespace
punctuation |
whitespace
classname Monad
whitespace
typevar m
whitespace \n
punctuation (
funcname =<<
punctuation )
whitespace
macroargument f
whitespace
macroargument x
whitespace
punctuation :==
whitespace
macroargumentinrhs x
whitespace
punctuation >>=
whitespace
macroargumentinrhs f
Function
-----
class Traversable t | Functor, Foldable t where
traverse :: (a -> f b) !(t a) -> f (t b) | Applicative f
sequenceA :: !(t (f a)) -> f (t a) | Applicative f
mapM :: (a -> m b) !(t a) -> m (t b) | Monad m
sequence :: !(t (m a)) -> m (t a) | Monad m
-----
keyword class
whitespace
classname Traversable
whitespace
typevar t
whitespace
punctuation |
whitespace
classname Functor
punctuation ,
whitespace
classname Foldable
whitespace
typevar t
whitespace
keyword where
whitespace \n\n
funcname traverse
whitespace
punctuation ::
whitespace
punctuation (
typevar a
whitespace
punctuation ->
whitespace
typevar f
whitespace
typevar b
punctuation )
whitespace
punctuation !(
typevar t
whitespace
typevar a
punctuation )
whitespace
punctuation ->
whitespace
typevar f
whitespace
punctuation (
typevar t
whitespace
typevar b
punctuation )
whitespace
punctuation |
whitespace
classname Applicative
whitespace
typevar f
whitespace \n
funcname sequenceA
whitespace
punctuation ::
whitespace
punctuation !(
typevar t
whitespace
punctuation (
typevar f
whitespace
typevar a
punctuation ))
whitespace
punctuation ->
whitespace
typevar f
whitespace
punctuation (
typevar t
whitespace
typevar a
punctuation )
whitespace
punctuation |
whitespace
classname Applicative
whitespace
typevar f
whitespace \n
funcname mapM
whitespace
punctuation ::
whitespace
punctuation (
typevar a
whitespace
punctuation ->
whitespace
typevar m
whitespace
typevar b
punctuation )
whitespace
punctuation !(
typevar t
whitespace
typevar a
punctuation )
whitespace
punctuation ->
whitespace
typevar m
whitespace
punctuation (
typevar t
whitespace
typevar b
punctuation )
whitespace
punctuation |
whitespace
classname Monad
whitespace
typevar m
whitespace \n
funcname sequence
whitespace
punctuation ::
whitespace
punctuation !(
typevar t
whitespace
punctuation (
typevar m
whitespace
typevar a
punctuation ))
whitespace
punctuation ->
whitespace
typevar m
whitespace
punctuation (
typevar t
whitespace
typevar a
punctuation )
whitespace
punctuation |
whitespace
classname Monad
whitespace
typevar m
Function
-----
mapAccumL :: (b -> (*s -> *(c, *s))) (t b) *s -> *(t c, *s) | Traversable t
-----
funcname mapAccumL
whitespace
punctuation ::
whitespace
punctuation (
typevar b
whitespace
punctuation ->
whitespace
punctuation (*
typevar s
whitespace
punctuation ->
whitespace
punctuation *(
typevar c
punctuation ,
whitespace
punctuation *
typevar s
punctuation )))
whitespace
punctuation (
typevar t
whitespace
typevar b
punctuation )
whitespace
punctuation *
typevar s
whitespace
punctuation ->
whitespace
punctuation *(
typevar t
whitespace
typevar c
punctuation ,
whitespace
punctuation *
typevar s
punctuation )
whitespace
punctuation |
whitespace
classname Traversable
whitespace
typevar t
Function
-----
mapArrayLSt :: (u:a -> .(.b -> (v:c,.b))) w:(d u:a) .b -> (x:(e v:c),.b) | Array e c & UnsafeArray d & UnsafeArray e & Array d a, [w <= u,x <= v]
-----
funcname mapArrayLSt
whitespace
punctuation ::
whitespace
punctuation (
typevar u
punctuation :
typevar a
whitespace
punctuation ->
whitespace
punctuation .(.
typevar b
whitespace
punctuation ->
whitespace
punctuation (
typevar v
punctuation :
typevar c
punctuation ,.
typevar b
punctuation )))
whitespace
typevar w
punctuation :(
typevar d
whitespace
typevar u
punctuation :
typevar a
punctuation )
whitespace
punctuation .
typevar b
whitespace
punctuation ->
whitespace
punctuation (
typevar x
punctuation :(
typevar e
whitespace
typevar v
punctuation :
typevar c
punctuation ),.
typevar b
punctuation )
whitespace
punctuation |
whitespace
classname Array
whitespace
typevar e
whitespace
typevar c
whitespace
punctuation &
whitespace
classname UnsafeArray
whitespace
typevar d
whitespace
punctuation &
whitespace
classname UnsafeArray
whitespace
typevar e
whitespace
punctuation &
whitespace
classname Array
whitespace
typevar d
whitespace
typevar a
punctuation ,
whitespace
punctuation [
typevar w
whitespace
punctuation <=
whitespace
typevar u
punctuation ,
typevar x
whitespace
punctuation <=
whitespace
typevar v
punctuation ]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment