# Difference between revisions of "HaskellWiki:Syntax highlighting/Breakage"

(On Intro page, links in Haskell code not working) |
|||

(17 intermediate revisions by 3 users not shown) | |||

Line 1: | Line 1: | ||

+ | :''Now fixed, see [[HaskellWiki talk:Syntax highlighting/Breakage|talk page]].'' |
||

+ | |||

+ | This page is an attempt to find a minimal criminal for the bugs in GeSHi, the syntax highlighter that powers <nowiki><haskell> and <hask></nowiki> on the Haskell wiki. |
||

+ | |||

<haskell> |
<haskell> |
||

x == '-' || True |
x == '-' || True |
||

+ | </haskell> |
||

+ | |||

+ | That breaks. |
||

+ | |||

+ | <haskell> |
||

+ | x :: String |
||

+ | x = map toUpper "hello" |
||

+ | </haskell> |
||

+ | |||

+ | Subsequent <nowiki><haskell></nowiki> blocks seem to independant of the breakages. |
||

+ | |||

+ | <haskell> |
||

+ | False || True |
||

+ | </haskell> |
||

+ | |||

+ | Looks like the (||) operator is causing the problems. |
||

+ | |||

+ | <haskell> |
||

+ | a || b |
||

+ | </haskell> |
||

+ | |||

+ | However, that works. Perhaps it only breaks when using literals? |
||

+ | |||

+ | <haskell> |
||

+ | 'a' || 'b' |
||

+ | </haskell> |
||

+ | |||

+ | No, characters work too. |
||

+ | |||

+ | <haskell>'a' || True</haskell> |
||

+ | <haskell>True || 'a'</haskell> |
||

+ | <haskell>5 || 'a'</haskell> |
||

+ | <haskell>'a' || 5</haskell> |
||

+ | <haskell>5 || True</haskell> |
||

+ | <haskell>True || 5</haskell> |
||

+ | |||

+ | Any kind of attempt to mix literals of different types breaks. |
||

+ | |||

+ | <haskell>'a' || 'b' -- chars work</haskell> |
||

+ | <haskell> "a" || "b" -- strings work</haskell> |
||

+ | |||

+ | I think any number or constructor on either side of the || makes it break. |
||

+ | |||

+ | <haskell> f 5 || g 6</haskell> |
||

+ | <haskell> f 'a' || g 6</haskell> |
||

+ | |||

+ | Function application with numbers fails too. |
||

+ | |||

+ | Mixing "a", 'a', or a on one side and a function taking the same on the other works: |
||

+ | |||

+ | <haskell> |
||

+ | "a" || isDigit 'a' |
||

+ | </haskell> |
||

+ | |||

+ | However, with a numeric argument, it's wrong: |
||

+ | <haskell> |
||

+ | "a" || isDigit 5 |
||

+ | </haskell> |
||

+ | |||

+ | Possible counterexample to 'constructors don't work': |
||

+ | <haskell> |
||

+ | a || A |
||

+ | </haskell> |
||

+ | |||

+ | Specifically, if they have two or more letters, they seem to fail: |
||

+ | <haskell> |
||

+ | a || Ab |
||

+ | </haskell> |
||

+ | |||

+ | More evidence: |
||

+ | |||

+ | <haskell>Ab || a</haskell> |
||

+ | <haskell>a || Ab</haskell> |
||

+ | <haskell>Ab || 'a'</haskell> |
||

+ | <haskell>'a' || Ab</haskell> |
||

+ | <haskell>Ab || "a"</haskell> |
||

+ | <haskell>"a" || Ab</haskell> |
||

+ | |||

+ | <haskell> |
||

+ | "a" || True |
||

+ | </haskell> |
||

+ | |||

+ | From the Intro page, '<' isn't linking, (++) goes to (.), (>=) isn't found |
||

+ | <haskell> |
||

+ | qsort [] = [] |
||

+ | qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs) |
||

</haskell> |
</haskell> |

## Latest revision as of 21:13, 12 October 2006

*Now fixed, see talk page.*

This page is an attempt to find a minimal criminal for the bugs in GeSHi, the syntax highlighter that powers <haskell> and <hask> on the Haskell wiki.

```
x == '-' || True
```

That breaks.

```
x :: String
x = map toUpper "hello"
```

Subsequent <haskell> blocks seem to independant of the breakages.

```
False || True
```

Looks like the (||) operator is causing the problems.

```
a || b
```

However, that works. Perhaps it only breaks when using literals?

```
'a' || 'b'
```

No, characters work too.

```
'a' || True
```

```
True || 'a'
```

```
5 || 'a'
```

```
'a' || 5
```

```
5 || True
```

```
True || 5
```

Any kind of attempt to mix literals of different types breaks.

```
'a' || 'b' -- chars work
```

```
"a" || "b" -- strings work
```

I think any number or constructor on either side of the || makes it break.

```
f 5 || g 6
```

```
f 'a' || g 6
```

Function application with numbers fails too.

Mixing "a", 'a', or a on one side and a function taking the same on the other works:

```
"a" || isDigit 'a'
```

However, with a numeric argument, it's wrong:

```
"a" || isDigit 5
```

Possible counterexample to 'constructors don't work':

```
a || A
```

Specifically, if they have two or more letters, they seem to fail:

```
a || Ab
```

More evidence:

```
Ab || a
```

```
a || Ab
```

```
Ab || 'a'
```

```
'a' || Ab
```

```
Ab || "a"
```

```
"a" || Ab
```

```
"a" || True
```

From the Intro page, '<' isn't linking, (++) goes to (.), (>=) isn't found

```
qsort [] = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs)
```