diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index 066ee421fb0744e484cefdd979493ba743b5e1d6..0e93dd043b38f10a44263fe472377491d82ea95f 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -626,7 +626,9 @@ identifier :: { Located RdrName }
         | qvarop                        { $1 }
         | qconop                        { $1 }
     | '(' '->' ')'      {% ams (sLL $1 $> $ getRdrName funTyCon)
-                               [mj AnnOpenP $1,mu AnnRarrow $2,mj AnnCloseP $3] }
+                               [mop $1,mu AnnRarrow $2,mcp $3] }
+    | '(' '~' ')'       {% ams (sLL $1 $> $ eqTyCon_RDR)
+                               [mop $1,mj AnnTilde $2,mcp $3] }
 
 -----------------------------------------------------------------------------
 -- Backpack stuff
diff --git a/testsuite/tests/ghci/scripts/T10059.script b/testsuite/tests/ghci/scripts/T10059.script
new file mode 100644
index 0000000000000000000000000000000000000000..d352b9f15c872094fee20a505618a5c73d158045
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T10059.script
@@ -0,0 +1,5 @@
+:set -XTypeOperators
+:i (~)
+:k (~)
+:set -fprint-equality-relations
+:i (~)
diff --git a/testsuite/tests/ghci/scripts/T10059.stdout b/testsuite/tests/ghci/scripts/T10059.stdout
new file mode 100644
index 0000000000000000000000000000000000000000..26e1e7e28f24ffa51c9783b19a9d2207d1c4c2b8
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T10059.stdout
@@ -0,0 +1,9 @@
+class (a ~ b) => (~) (a :: k) (b :: k)
+  	-- Defined in ‘Data.Type.Equality’
+instance [incoherent] forall k (a :: k) (b :: k). (a ~ b) => a ~ b
+  -- Defined in ‘Data.Type.Equality’
+(~) :: k -> k -> Constraint
+class (a ~~ b) => (~) (a :: k) (b :: k)
+  	-- Defined in ‘Data.Type.Equality’
+instance [incoherent] forall k (a :: k) (b :: k). (a ~~ b) => a ~ b
+  -- Defined in ‘Data.Type.Equality’
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 163ff0c2da91ecf5a9c22f3d3962b36c40a8a522..29fbdf85c5a36ba4399210e7e381bfd8f312dae7 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -201,6 +201,7 @@ test('T9878', [], ghci_script, ['T9878.script'])
 test('T9878b', [extra_run_opts('-fobject-code')], ghci_script,
      ['T9878b.script'])
 test('T10018', normal, ghci_script, ['T10018.script'])
+test('T10059', normal, ghci_script, ['T10059.script'])
 test('T10122', normal, ghci_script, ['T10122.script'])
 
 test('T10321', normal, ghci_script, ['T10321.script'])