1
0
mirror of https://github.com/IHaskell/IHaskell.git synced 2025-04-19 12:56:08 +00:00

allowing two type signatures together

This commit is contained in:
Andrew Gibiansky 2014-05-17 22:29:39 -07:00
parent 9b95c5e3ff
commit c30de057c7
2 changed files with 18 additions and 4 deletions
notebooks
src/IHaskell/Eval

@ -36,7 +36,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
":ext Impli\n",
":ext NoImplicitPrelude\n",
"4 + 4"
],
"language": "python",
@ -45,14 +45,18 @@
},
"outputs": [
{
"html": [
"<span class='err-msg'>Not in scope: `+'<br/>Perhaps you meant `IHaskellPrelude.+' (imported from Prelude)</span>"
],
"metadata": {},
"output_type": "display_data",
"text": [
"8"
"Not in scope: `+'\n",
"Perhaps you meant `IHaskellPrelude.+' (imported from Prelude)"
]
}
],
"prompt_number": 2
"prompt_number": 3
},
{
"cell_type": "code",
@ -96,7 +100,9 @@
"parser"
],
"language": "python",
"metadata": {},
"metadata": {
"hidden": false
},
"outputs": [
{
"javascript": [

@ -218,6 +218,14 @@ joinFunctions (Located line (TypeSignature sig) : Located dl (Declaration decl)
Located line (Declaration $ sig ++ "\n" ++ joinedDecl):remaining
where Located _ (Declaration joinedDecl):remaining = joinFunctions $ Located dl (Declaration decl) : rest
-- Also allow two type signatures. This is necessary for operator
-- declarations in which you have a fixity declaration.
joinFunctions (Located line (TypeSignature sig) :
Located _ (TypeSignature sig') :
Located dl (Declaration decl) : rest) =
Located line (Declaration $ intercalate "\n" [sig, sig', joinedDecl]):remaining
where Located _ (Declaration joinedDecl):remaining = joinFunctions $ Located dl (Declaration decl) : rest
joinFunctions (x:xs) = x : joinFunctions xs
joinFunctions [] = []