Taillefer, Troy (EXP) wrote:
Hi there
1. First of all never forget your base case for exiting your recursion
2. you need to break up the problem like so
import Char
-- get the first word
word :: String -> String
word [] = []
word ( x : x1 : xs )
| isSpace x = []
| isSpace x1 =
Neil Mitchell wrote:
> Hi Alexy,
>
>> Now I'm reading a
>> Haskell book which states the same. Is there a more efficient Haskell
>> string-handling method? Which functional language is the most
>> suitable for text processing?
>
> There are the Data.ByteString things, which are great, and have m
Marco TĂșlio Gontijo e Silva wrote:
Hello,
I'm trying to define a partition__ function that is like
Data.Set.partition, but use State Monad:
import Data.Set
import Control.Monad.State
partition__ f =
do
snapshot <- get
let
(firsts, rest) = Set.partition f snapshot
put
Yitzchak Gale wrote:
It's short, so I'll post it here.
Any comments?
readDev :: Storable a => FilePath -> BlockingMode -> IO (Maybe a)
readDev dev mode = do
h <- openFile dev ReadMode
hSetBuffering h NoBuffering
alloca $ getMaybe h undefined
where
getMaybe :: Storable a => Handle
Julien Oster wrote:
Hello,
The type of the monadic bind function in the Monad class is
Monad m => m a -> (a -> m b) -> m b
Now, would it be possible to create a monad with a slightly stricter
type, like
StrictMonat m => m a -> (a -> m a) -> m a
and, accepting that all steps of the computat
Daniel McAllansmith wrote:
Hello.
Given:
newtype Dist a = D {unD :: [(a,Int)]}
instance Monad Dist where
return x = D [(x,1)]
d >>= f = D [(y,q*p) | (x,p) <- unD d, (y,q) <- unD (f x)]
fail _ = D []
How would one change Dist to wrap an instance of the (Data.Edison.Set c a)
typeclas
Yitzchak Gale wrote:
Bryan Donlan wrote:
This re-opens the device every time we need it.
How about opening once, when it's first needed?
Good idea.
hDevRandom :: Handle
{-# NOINLINE hDevRandom #-}
hDevRandom = unsafePerformIO $ openFile "/dev/random" ReadMode
hDevUR
Eric Olander wrote:
Hi,
I'm still somewhat new to Haskell, so I'm wondering if there are
better ways I could implement the following functions, especially shiftl:
>> moves the first element to the end of the list
shiftr :: [a] -> [a]
shiftr [] = []
shiftr (x:y) = y ++ [x]
Martin DeMello wrote:
On 2/5/07, Bulat Ziganshin <[EMAIL PROTECTED]> wrote:
Hello J.,
Sunday, February 4, 2007, 11:46:57 PM, you wrote:
> exists s wmap = isJust $ find (==s) . snd =<< Map.lookup (sort s) wmap
exists s wmap = Map.lookup (sort s) wmap
>>== snd
mented somewhere (or is it?). Otherwise Control.Exception's docs
should be updated to provide a more correct example and/or the caveat
that >>= must not be left-strict for the example implementation to be
correct.
Thanks,
Bryan Donlan
signature.asc
Description: Digital signature
_
urrent implementation? (Note, I'm testing with GHC 6.8.2,
so it's possible this might be fixed in trunk already...)
Thanks,
Bryan Donlan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Mon, Jul 28, 2008 at 08:48:23PM -0500, Galchin, Vasili wrote:
> what does a datatype with no constructors mean?
>
> E.g.
>
> data RSAStruct
> data EVP_PKEY
> data EVP_CIPHER
> data EVP_CIPHER_CTX
> data EVP_MD_CTX
> data EVP_MD
> data BIGNUM
It's simply a datatype that can never have a value
12 matches
Mail list logo