[Haskell-cafe] Why purely in haskell?

Sebastian Sylvan sebastian.sylvan at gmail.com
Thu Jan 10 15:26:42 EST 2008


On Jan 10, 2008 8:12 PM, David Roundy <droundy at darcs.net> wrote:
>
> On Thu, Jan 10, 2008 at 08:10:57PM +0000, Sebastian Sylvan wrote:
> > On Jan 10, 2008 8:06 PM, Ketil Malde <ketil+haskell at ii.uib.no> wrote:
> > > "David Roundy" <daveroundy at gmail.com> writes:
> > >
> > > >> > I just want to point out that unsafePerformIO is at the core of the
> > > >> > (safe) bytestring library.  As SPJ et al pointed out, this is crucial
> > > >> > functionality, and is only unsafe if unsafely used.
> > >
> > > >> In Modula-3 modules using hacks must be explicitly marked as UNSAFE. See
> > > >>   http://www.cs.purdue.edu/homes/hosking/m3/reference/unsafe.html
> > > >>  Maybe this is also an option for Haskell?
> > >
> > > > I don't think this is a good idea.
> > >
> > > I think the point is (should be) to mark functions unsafe when they
> > > may be unsafe to /use/,
> >
> > I think using the IO monad for this works well...
>
> Would you suggest moving head and tail into the IO monad?


They're not really unsafe, though, they just have the potential to
fail (from which you can recover). Unsafe to me mean "may reformat
your harddrive, kill your dog, and break up with your girlfriend".
They really should return a Maybe type, but I recognize that this
would be inconvenient (so would having e.g. integer division returning
Maybe).


> --
> David Roundy
> Department of Physics
> Oregon State University
> _______________________________________________
>
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862


More information about the Haskell-Cafe mailing list