module Data.Array.Comfort.Shape.Utility where

import Text.Printf (printf)


messageIndexFromOffset :: String -> Int -> String
messageIndexFromOffset :: String -> Int -> String
messageIndexFromOffset String
name Int
k =
   String -> String -> Int -> String
forall r. PrintfType r => String -> r
printf String
"indexFromOffset (%s): index %d out of range" String
name Int
k

errorIndexFromOffset :: String -> Int -> a
errorIndexFromOffset :: forall a. String -> Int -> a
errorIndexFromOffset String
name = String -> a
forall a. HasCallStack => String -> a
error (String -> a) -> (Int -> String) -> Int -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Int -> String
messageIndexFromOffset String
name


isRight :: Either a b -> Bool
isRight :: forall a b. Either a b -> Bool
isRight = (a -> Bool) -> (b -> Bool) -> Either a b -> Bool
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (Bool -> a -> Bool
forall a b. a -> b -> a
const Bool
False) (Bool -> b -> Bool
forall a b. a -> b -> a
const Bool
True)