Partial functions from the Haskell base library, such as head and !!, modified

to return more descriptive error messages, programmer defined error messages,
Maybe wrapped results and default values.

These functions can be used to reduce the number of unsafe pattern matches in
your code.

WWW: http://www-users.cs.york.ac.uk/~ndm/safe/

PR:		ports/142144
Submitted by:	Jacula Modyun <jacula(at)gmail.com>
This commit is contained in:
Gabor Pali 2010-01-02 22:59:58 +00:00
parent 086316c4aa
commit 4151fdbbf3
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=247026
5 changed files with 100 additions and 0 deletions

View file

@ -551,6 +551,7 @@
SUBDIR += hs-mmap
SUBDIR += hs-pcre-light-ghc
SUBDIR += hs-readline
SUBDIR += hs-safe
SUBDIR += hs-uniplate
SUBDIR += hs-utf8-string-ghc
SUBDIR += hs-uuagc

75
devel/hs-safe/Makefile Normal file
View file

@ -0,0 +1,75 @@
# New ports collection makefile for: hs-safe
# Date created: December 20 2009
# Whom: Giuseppe Pilichi aka Jacula Modyun <jacula@gmail.com>
#
# $FreeBSD$
#
PORTNAME= safe
PORTVERSION= 0.2
CATEGORIES= devel haskell
MASTER_SITES= http://hackage.haskell.org/packages/archive/${PORTNAME}/${PORTVERSION}/
PKGNAMEPREFIX= hs-
MAINTAINER= jacula@gmail.com
COMMENT= A Haskell library for safe (pattern match free) functions
BUILD_DEPENDS+= ghc:${PORTSDIR}/lang/ghc
RUN_DEPENDS+= ghc:${PORTSDIR}/lang/ghc
GHC_VERSION= 6.10.4
SAFE_VERSION= ${PORTVERSION}
GHC_CMD= ${LOCALBASE}/bin/ghc
SETUP_CMD= ./setup
DOCSDIR= ${PREFIX}/share/doc/${DISTNAME}
SAFE_LIBDIR_REL= lib/${DISTNAME}
PLIST_SUB= GHC_VERSION=${GHC_VERSION} \
SAFE_VERSION=${SAFE_VERSION} \
SAFE_LIBDIR_REL=${SAFE_LIBDIR_REL}
.if defined(NOPORTDOCS)
PLIST_SUB+= NOPORTDOCS=""
.else
PLIST_SUB+= NOPORTDOCS="@comment "
.endif
.if !defined(NOPORTDOCS)
PORT_HADDOCK!= (cd ${.CURDIR}/../../lang/ghc && ${MAKE} -V PORT_HADDOCK)
.if !empty(PORT_HADDOCK:M?0)
BUILD_DEPENDS+= haddock:${PORTSDIR}/devel/hs-haddock
.endif
BUILD_DEPENDS+= HsColour:${PORTSDIR}/print/hs-hscolour
HSCOLOUR_VERSION= 1.15
HSCOLOUR_DATADIR= ${PREFIX}/share/hscolour-${HSCOLOUR_VERSION}
PORTDOCS= *
.endif
.SILENT:
do-configure:
cd ${WRKSRC} && ${GHC_CMD} --make Setup.hs -o setup -package Cabal \
&& ${SETUP_CMD} configure --haddock-options=-w --prefix=${PREFIX}
do-build:
cd ${WRKSRC} && ${SETUP_CMD} build \
&& ${SETUP_CMD} register --gen-script
.if !defined(NOPORTDOCS)
cd ${WRKSRC} && ${SETUP_CMD} haddock --hyperlink-source \
--hscolour-css=${HSCOLOUR_DATADIR}/hscolour.css
.endif
do-install:
cd ${WRKSRC} && ${SETUP_CMD} install \
&& ${INSTALL_SCRIPT} register.sh ${PREFIX}/${SAFE_LIBDIR_REL}/register.sh
post-install:
${RM} -f ${PREFIX}/lib/ghc-${GHC_VERSION}/package.conf.old
.include <bsd.port.mk>

3
devel/hs-safe/distinfo Normal file
View file

@ -0,0 +1,3 @@
MD5 (safe-0.2.tar.gz) = e5331578ea7e0b68ed1ea4df923a23ca
SHA256 (safe-0.2.tar.gz) = 73b9a247c3ba8092236c8c912687399778ff31bf3df42d707563a1528a6fc0e0
SIZE (safe-0.2.tar.gz) = 3557

8
devel/hs-safe/pkg-descr Normal file
View file

@ -0,0 +1,8 @@
Partial functions from the Haskell base library, such as head and !!, modified
to return more descriptive error messages, programmer defined error messages,
Maybe wrapped results and default values.
These functions can be used to reduce the number of unsafe pattern matches in
your code.
WWW: http://www-users.cs.york.ac.uk/~ndm/safe/

13
devel/hs-safe/pkg-plist Normal file
View file

@ -0,0 +1,13 @@
@comment $FreeBSD$
%%SAFE_LIBDIR_REL%%/ghc-%%GHC_VERSION%%/HSsafe-%%SAFE_VERSION%%.o
%%SAFE_LIBDIR_REL%%/ghc-%%GHC_VERSION%%/Safe.hi
%%SAFE_LIBDIR_REL%%/ghc-%%GHC_VERSION%%/libHSsafe-%%SAFE_VERSION%%.a
%%SAFE_LIBDIR_REL%%/register.sh
%%NOPORTDOCS%%%%DOCSDIR%%/LICENSE
%%NOPORTDOCS%%@dirrmtry %%DOCSDIR%%
@dirrm %%SAFE_LIBDIR_REL%%/ghc-%%GHC_VERSION%%
@dirrm %%SAFE_LIBDIR_REL%%
@exec /bin/sh %D/%%SAFE_LIBDIR_REL%%/register.sh
@exec /bin/rm -f %D/lib/ghc-%%GHC_VERSION%%/package.conf.old
@unexec %D/bin/ghc-pkg unregister safe
@unexec /bin/rm -f %D/lib/ghc-%%GHC_VERSION%%/package.conf.old