<!doctype html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<div style="" class="default-style">
I was surprised to find the below code doesn't typecheck even with -XLiberalTypeSynonyms. Am I missing something or is this really not possible?
<br>
</div>
<div style="" class="default-style">
<br>
</div>
<div style="" class="default-style">
Thanks,
<br>
</div>
<div style="" class="default-style">
Tom
<br>
</div>
<div style="" class="default-style">
<br>
</div>
<div style="" class="default-style">
---
<br>
</div>
<div style="" class="default-style">
<br>
</div>
<div style="" class="default-style">
<div class="default-style">
{-# LANGUAGE FlexibleInstances, KindSignatures, LiberalTypeSynonyms, StandaloneDeriving #-}
</div>
<div class="default-style">
-- This works:
<br>data Foo s x = Foo (s x) x
<br>deriving (Eq)
</div>
<div class="default-style">
-- This replacement doesn't:
<br>{-
<br>data Foo' sx x = Foo' sx x
<br>deriving (Eq)
<br>type Foo (s :: * -> *) (x :: *) = Foo' (s x) x
<br>-}
</div>
<div class="default-style">
data Bar (m :: * -> *) = Bar (m Int)
</div>
<div class="default-style">
<br>
</div>
<div class="default-style">
-- Neither of these typecheck:
<br>x :: Bar (Foo Maybe)
<br>x = undefined
<br>
</div>
<div class="default-style">
deriving instance Eq (Bar (Foo Maybe))
<br>
</div>
<div class="default-style">
<br>
</div>
</div>
</body>
</html>