BootString throws regular exceptions now

darcs-hash:20080120005332-a4fee-9c09d47827db967d396c155a09cfa719d05f2c27
This commit is contained in:
Henning Guenther 2008-01-19 16:53:32 -08:00
parent 3b9a84b979
commit 1510b86c10

View File

@ -10,6 +10,7 @@ import Data.ByteString.Char8 (pack,unpack)
import Data.List (unfoldr,partition)
import Data.Char (ord,chr)
import Data.Typeable
import Control.Exception (throwDyn)
data BootString = BootString
{base :: Int
@ -44,7 +45,7 @@ punyValue c
| otherwise = norep
where
n = ord c
norep = error $ "No puny representation for "++show c
norep = throwDyn (HasNoRepresentation c)
punyChar :: Int -> Char
punyChar c
@ -53,7 +54,7 @@ punyChar c
| c < 36 = chr $ 0x30+c-26
| otherwise = norep
where
norep = error $ "No char representation for puny value "++show c
norep = throwDyn OutOfRange
threshold :: BootString -> Int -> Int -> Int
threshold bs bias pos