Commit e1674ac4 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.
Browse files

TypeFamilies: should_compile/Simple21

* Code of #1776 from aslatter@gmail.com
parent 927fe3b4
{-# LANGUAGE TypeFamilies #-}
module ShouldCompile where
import Prelude hiding (foldr, foldr1)
import Data.Maybe
type family Elem x
class Foldable a where
foldr :: (Elem a -> b -> b) -> b -> a -> b
foldr1 :: (Elem a -> Elem a -> Elem a) -> a -> Elem a
foldr1 f xs = fromMaybe (error "foldr1: empty structure")
(foldr mf Nothing xs)
where mf x Nothing = Just x
mf x (Just y) = Just (f x y)
...@@ -21,6 +21,7 @@ test('Simple17', expect_fail, compile, ['']) ...@@ -21,6 +21,7 @@ test('Simple17', expect_fail, compile, [''])
test('Simple18', normal, compile, ['']) test('Simple18', normal, compile, [''])
test('Simple19', normal, compile, ['']) test('Simple19', normal, compile, [''])
test('Simple20', normal, compile, ['']) test('Simple20', normal, compile, [''])
test('Simple21', normal, compile, [''])
test('Simple22', normal, compile, ['']) test('Simple22', normal, compile, [''])
test('Simple23', normal, compile, ['']) test('Simple23', normal, compile, [''])
......
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