|
3 | 3 | {-# LANGUAGE FlexibleContexts #-} |
4 | 4 | {-# LANGUAGE FlexibleInstances #-} |
5 | 5 | {-# LANGUAGE FunctionalDependencies #-} |
6 | | -{-# LANGUAGE GADTs #-} |
7 | 6 | {-# LANGUAGE NoImplicitPrelude #-} |
8 | | -{-# LANGUAGE PolyKinds #-} |
9 | 7 | {-# LANGUAGE RankNTypes #-} |
10 | 8 | {-# LANGUAGE ScopedTypeVariables #-} |
11 | 9 | {-# LANGUAGE TypeApplications #-} |
12 | 10 | {-# LANGUAGE TypeFamilies #-} |
13 | | -{-# LANGUAGE TypeOperators #-} |
14 | 11 | {-# LANGUAGE UndecidableInstances #-} |
15 | | -{-# OPTIONS_GHC -fno-warn-orphans #-} |
16 | 12 |
|
17 | 13 | {-- | Compilation function to transform expressions into closed cartesian category form. |
18 | 14 | Use CatExpr as a compilation target to produce categorical morphisms. |
|
24 | 20 | module CCC.CCC (toCCC, toCCCRec, Rec(..), fixRec) where |
25 | 21 |
|
26 | 22 | import CCC.Cat |
27 | | -import CCC.Hask () |
28 | 23 | import Prelude hiding (id, (.)) |
29 | 24 |
|
30 | 25 | -- Newtype wrapper for recursive functions in categorical style |
@@ -70,17 +65,6 @@ instance (b ~ out) => EitherTree () b out where |
70 | 65 | inj x = x |
71 | 66 | ext x = x |
72 | 67 |
|
73 | | -instance (Num b, Num a) => Num (Either a b) where |
74 | | - (Left f) + (Left g) = Left (f + g) |
75 | | - (Right f) + (Right g) = Right (f + g) |
76 | | - (Left f) * (Left g) = Left (f * g) |
77 | | - (Right f) * (Right g) = Right (f * g) |
78 | | - negate f = error "Todo" |
79 | | - f - g = error "todo" |
80 | | - abs f = error "todo" |
81 | | - signum = error "TODO" |
82 | | - fromInteger = error "TODO" |
83 | | - |
84 | 68 | type family Reverse a b where |
85 | 69 | Reverse (Left a) b = Reverse a (Left b) |
86 | 70 | Reverse (Right a) b = Reverse a (Right b) |
|
0 commit comments