Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Generic-swap/Haskell/generic-swap-1.hs
Normal file
2
Task/Generic-swap/Haskell/generic-swap-1.hs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
swap :: (a, b) -> (b, a)
|
||||
swap (x, y) = (y, x)
|
||||
7
Task/Generic-swap/Haskell/generic-swap-2.hs
Normal file
7
Task/Generic-swap/Haskell/generic-swap-2.hs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import Control.Monad.Ref
|
||||
swap :: MonadRef r m => r a -> r a -> m ()
|
||||
swap xRef yRef = do
|
||||
x<-readRef xRef
|
||||
y<-readRef yRef
|
||||
writeRef xRef y
|
||||
writeRef yRef x
|
||||
Loading…
Add table
Add a link
Reference in a new issue