Commit ac8a4260 authored by Michael Hanus's avatar Michael Hanus
Browse files

Findall: allHNFs removed, isFail added

parent af93910d
......@@ -11,7 +11,7 @@
--- in order to support a more portable standard prelude.
---
--- @author Michael Hanus
--- @version July 2015
--- @version July 2018
--- @category general
------------------------------------------------------------------------------
{-# LANGUAGE CPP #-}
......@@ -21,8 +21,8 @@ module Findall
( getAllValues, getSomeValue
, allValues, someValue
, allSolutions, someSolution
, isFail
#ifdef __PAKCS__
, allHNFs
, try, inject, solveAll, once, best
, findall, findfirst, browse, browseList, unpack
, rewriteAll, rewriteSome
......@@ -116,15 +116,17 @@ someSolution p = findfirst (\x -> p x =:= True)
someSolution p = someValue (let x free in p x &> x)
#endif
--- Does the computation of the argument to a head-normal form fail?
--- Conceptually, the argument is evaluated on a copy, i.e.,
--- even if the computation does not fail, it has not been evaluated.
isFail :: a -> Bool
#ifdef __PAKCS__
--- Returns all head normal forms of an expression (currently, via an incomplete
--- depth-first strategy).
---
--- Note that this operation is not purely declarative since the ordering
--- of the computed values depends on the ordering of the program rules.
allHNFs :: a -> [a]
allHNFs external
isFail external
#else
isFail x = null (allValues (x `seq` ()))
#endif
#ifdef __PAKCS__
------------------------------------------------------------------------------
--- Basic search control operator.
try :: (a -> Bool) -> [a -> Bool]
......
......@@ -9,9 +9,9 @@
<library>prim_standard</library>
<entry>prim_findfirst[raw]</entry>
</primitive>
<primitive name="allHNFs" arity="1">
<primitive name="isFail" arity="1">
<library>prim_standard</library>
<entry>prim_allHNFs[raw]</entry>
<entry>prim_isFail[raw]</entry>
</primitive>
<primitive name="try" arity="1">
<library>prim_standard</library>
......
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