Verified Commit 4b596266 authored by Camil Staps's avatar Camil Staps 🙂

Move Functor instances

parent df224d7a
definition module Data.Func
from Data.Functor import class Functor
instance Functor ((->) r)
/**
* Function application.
* @type (a -> b) a -> b
......
implementation module Data.Func
from StdFunc import o
import Data.Functor
instance Functor ((->) r)
where
fmap f g = \x -> (f o g) x
seqSt :: !(a .st -> .st) ![a] !.st -> .st
seqSt f [] st = st
seqSt f [x:xs] st = seqSt f xs (f x st)
......
......@@ -17,7 +17,3 @@ class Functor f where
void :: !(f a) -> f () | Functor f
void x :== () <$ x
instance Functor ((->) r)
instance Functor ((,) a)
implementation module Data.Functor
from StdFunc import o
import Control.Applicative
instance Functor ((->) r) where
fmap f g = \x -> (f o g) x
instance Functor ((,) a) where
fmap f (x, y) = (x, f y)
......@@ -16,6 +16,7 @@ from Control.Monad import class Monad
import qualified Control.Monad as CM
from Data.Monoid import class Monoid
import Data.Maybe
import Data.Tuple
from StdFunc import o, id, flip
instance Traversable Maybe where
......
definition module Data.Tuple
from Data.Functor import class Functor
tuple :: a b -> (a,b)
tuple3 :: a b c -> (a,b,c)
......@@ -11,3 +13,5 @@ appSnd3 :: (.b -> .d) !(.a,.b,.c) -> (.a,.d,.c)
appThd3 :: (.c -> .d) !(.a,.b,.c) -> (.a,.b,.d)
swap :: !(a, b) -> (b, a)
instance Functor ((,) a)
implementation module Data.Tuple
import Data.Functor
tuple :: a b -> (a,b)
tuple a b = (a,b)
......@@ -23,3 +25,7 @@ appThd3 f (a,b,c) = (a,b,f c)
swap :: !(a, b) -> (b, a)
swap (a,b) = (b,a)
instance Functor ((,) a)
where
fmap f (x, y) = (x, f y)
......@@ -5,7 +5,7 @@ import Data.Maybe, Data.List, Text, Text.Encodings.UrlEncoding, Text.Encodings.M
from Data.Map import get, put, :: Map (..), newMap, fromList, toList, toAscList, foldrWithKey
from StdFunc import id
from Data.Func import $
from Data.Func import $, instance Functor ((->) r)
import Data.Error
import Text.URI
import Data.Functor
......
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