acme-safe (empty) → 0.1.0.0
raw patch · 4 files changed
+63/−0 lines, 4 filesdep +acme-dontdep +basesetup-changed
Dependencies added: acme-dont, base
Files
- Acme/Safe.hs +28/−0
- LICENSE +13/−0
- Setup.hs +2/−0
- acme-safe.cabal +20/−0
+ Acme/Safe.hs view
@@ -0,0 +1,28 @@+module Acme.Safe where++import Acme.Dont++-- | Safely extract a value from a Just+safeFromJust :: Maybe a -> Maybe a+safeFromJust Nothing = Nothing+safeFromJust (Just x) = Just x++-- | Safely extract a value from a Left+safeFromLeft :: Either a b -> Either a b+safeFromLeft (Left x) = Left x+safeFromLeft (Right x) = Right x++-- | Safely doesn't perform IO with the help of acme-dont. Side-effects-free!+safePerformIO :: IO a -> Maybe (IO ())+safePerformIO = Just . don't+--safePerformIO launchMissiles = Nothing --ready for the upcoming function-pattern-matching++-- | Doesn't print the provided debug string. But it's 100% safe!+safeTrace :: String -> a -> Maybe (IO ())+safeTrace s x = safePerformIO $ do+ putStrLn s+ return x++-- | Safely converts a value from any type to any other type.+safeCoerce :: a -> Maybe b+safeCoerce _ = Nothing
+ LICENSE view
@@ -0,0 +1,13 @@+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 ++ Copyright (C) 2015 Francesco Gazzetta++ Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. ++ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ++ 0. You just DO WHAT THE FUCK YOU WANT TO.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ acme-safe.cabal view
@@ -0,0 +1,20 @@+name: acme-safe+version: 0.1.0.0+synopsis: Safe versions of some infamous haskell functions such as fromJust+-- description: +homepage: http://github.com/fgaz/acme-safe+license: OtherLicense+license-file: LICENSE+author: Francesco Gazzetta+--maintainer: fgaz@users.noreply.github.com+category: ACME+build-type: Simple+cabal-version: >=1.10+++library+ exposed-modules: Acme.Safe + build-depends: base < 666+ , acme-dont+ default-language: Haskell2010+