Aelve Codesearch

grep over package repositories
Please provide a string to search for.
3+ characters are required.
Index updated 2 months ago

total matches: more than 1000

3dmodels-0.3.0
2 matches
Graphics/Model/MikuMikuDance/Loader.hs
ltrTrans (V3 x y z) = V3 x y (-z)
ltrEular (V3 x y z) = V3 (-x) (-y) z
ltrQuat (V4 t i j k) = V4 (-t) i j k
getPos = fmap ltrTrans getV3
getEular = fmap ltrEular getV3
getQuat = fmap ltrQuat getV4


-- * PMX

loadMMD :: FilePath -> IO MMD 

            
Graphics/Model/MikuMikuDance/Loader.hs
		-- 0:Base, 1:Brow, 2: Eye, 3: Lip, 4:Other
		-- XXX 'base' should be ignored (0,0,0)???
		vMorph <- replicateM numVertices $
			VertexMorph <$> fmap fromIntegral getWord32LE <*> getPos
		return $ MMDMorph name "" facial vMorph
		
	faceListLen <- getWord8Int
	faceList <- replicateM faceListLen getMorphIndex


            
ABList-0.0.3
2 matches
src/Data/AbList.hs
abFromListEither :: [Either a b] -> Maybe (AbList a b)
abFromListEither [] = Just AbNil
abFromListEither (Left a : []) = Just $ a :/ AbNil
abFromListEither (Left a : Right b : xs) = fmap (\t -> a :/ b :/ t) (abFromListEither xs)
abFromListEither _ = Nothing

abHead :: AbList a b -> Maybe a
abHead = abShallowFold Nothing $ const . Just


            
src/Data/AbList.hs

-- right-biased functor
instance Functor (AbList a) where
  fmap = abMapRights


            
ADPfusionForest-0.0.0.1
2 matches
src/AffineAlignNewickTreesSmall.hs
  printf "Score: %10d\n" sc
--  forM_ bt $ \b -> do
--    putStrLn ""
--    forM_ b $ \x -> putStrLn $ T.drawTree $ fmap show x
{-# NoInline runAlignS #-}

runAlignIO fw probFileTy probFile t1' t2' matchSc mismatchSc indelSc affinSc temperature = do
  let f x = either error (F.forestPre . map getNewickTree) $ newicksFromText x
      t1 = f $ Text.pack t1'

            
src/AlignNewickTrees.hs
  printf "Score: %10d\n" sc
  forM_ bt $ \b -> do
    putStrLn ""
    forM_ b $ \x -> putStrLn $ T.drawTree $ fmap show x

runAlignIO fw probFileTy probFile t1' t2' matchSc mismatchSc indelSc temperature = do
  let f x = either error (F.forestPre . map getNewickTree) $ newicksFromText x
      t1 = f $ Text.pack t1'
      t2 = f $ Text.pack t2'

            
AERN-Basics-2011.1.0.1
2 matches
src/Numeric/AERN/Basics/NumericOrder/PartialComparison.hs
    pGreaterEff :: (PartialCompareEffortIndicator t) -> t -> t -> Maybe Bool
    
    -- defaults for all convenience operations:
    pEqualEff effort a b = fmap (== EQ) (pCompareEff effort a b)
    pLessEff effort a b = fmap (== LT) (pCompareEff effort a b)
    pGreaterEff effort a b = fmap (== GT) (pCompareEff effort a b)
    pComparableEff effort a b = fmap (/= NC) (pCompareEff effort a b)
    pIncomparableEff effort a b = fmap (== NC) (pCompareEff effort a b)
    pLeqEff effort a b = fmap (`elem` [EQ,LT,LEE]) (pCompareEff effort a b)
    pGeqEff effort a b = fmap (`elem` [EQ,GT,GEE]) (pCompareEff effort a b)


instance PartialComparison Int where
    type PartialCompareEffortIndicator Int = ()
    pCompareDefaultEffort _ = ()

            
src/Numeric/AERN/Basics/RefinementOrder/PartialComparison.hs
    pGreaterEff :: (PartialCompareEffortIndicator t) -> t -> t -> Maybe Bool
    
    -- defaults for all convenience operations:
    pEqualEff effort a b = fmap (== EQ) (pCompareEff effort a b)
    pLessEff effort a b = fmap (== LT) (pCompareEff effort a b)
    pGreaterEff effort a b = fmap (== GT) (pCompareEff effort a b)
    pComparableEff effort a b = fmap (/= NC) (pCompareEff effort a b)
    pIncomparableEff effort a b = fmap (== NC) (pCompareEff effort a b)
    pLeqEff effort a b = fmap (`elem` [EQ,LT,LEE]) (pCompareEff effort a b)
    pGeqEff effort a b = fmap (`elem` [EQ,GT,GEE]) (pCompareEff effort a b)


propPartialComparisonReflexiveEQ :: 
    (PartialComparison t) => 
    t -> 

            
AERN-RnToRm-0.5.0.1
1 matches
src/Data/Number/ER/RnToRm/BisectionTree/Integration.hs
    (_, resultBistrs, _) = 
        integrateBistrOriginHere $ BISTR.syncMany valSplitter ix bistrs 
    maybeSupport = -- extend resultSupport to cover the origin
        fmap extendToOrigin maybeResultSupport
        where
        extendToOrigin domB =
            case DBox.member ivar domB of
                True -> DBox.insertWith (RA.\/) ivar origin domB
                False -> domB

            
AERN-RnToRm-Plot-0.2.0.3
1 matches
src/Data/Number/ER/RnToRm/Plot/FnView.hs
            return ()
    where
    getFnValueTexts evalPointText =
        fmap (eval . RA.double2ra) $ readMaybe evalPointText
        where
--        eval :: (ERIntApprox ira) => ra -> [[String]] 
        eval evalPoint =
            map (map show . getDimValueTexts) $ dataFAs fadata
            where

            
AFSM-0.1.3.1
6 matches
src/Control/AFSM/Core.hs
concatSM = joinSM

-- eventOutSM :: SM a b -> SM a (Event b)
-- eventOutSM = fmap Event

-- eventSM :: SM a b -> SM (Event a) (Event b)
-- eventSM = undefined

-- slowdownSM :: SM a [b] -> SM a (Event b)

            
src/Control/AFSM/Core.hs
-- Functor

instance Functor (SM s a) where
  fmap = fmapSM

-- | fmapSM f sm = sm >>> arr f
fmapSM :: (b -> c) -> SM s a b -> SM s a c
fmapSM f sm = absorbR sm f

            
src/Control/AFSM/Event.hs
    ys = (extractEvents xs)
    
instance Functor Event where
  fmap f (Event a) = Event (f a)
  fmap _ NoEvent = NoEvent
  fmap _ (ErrEvent s) = (ErrEvent s)
  fmap _  ExitEvent = ExitEvent
  
instance Applicative Event where
  pure a = Event a
  (<*>) (Event f) m = fmap f m
  (<*>) (ErrEvent s0) (ErrEvent s1) = ErrEvent $ s0 ++ "," ++ s1
  (<*>) (ErrEvent s0) _ = ErrEvent s0
  (<*>) ExitEvent _ = ExitEvent
  (<*>) NoEvent _ = NoEvent


            
src/Control/AFSM/SMFunctor.hs

class SMFunctor f where
  smexec :: SM s a b -> f a -> (SM s a b, f b)
  smfmap :: SM s a b -> f a -> f b
  smfmap sm a = snd $ smexec sm a 

instance SMFunctor [] where
  smexec sm [] = (sm, [])
  smexec (SM (TF f) s) (x:xs) = (sm'', b:bs)
    where

            
src/Control/AFSM/SMFunctor.hs
    (sm', mmb) = smexec sm ma

(>>>=) :: (Monad m, SMFunctor m) => m a -> SM s a (m b) -> m b
(>>>=) ma sm = join $ smfmap sm ma

{-

-- require WrappedMonad.


            
src/Control/AFSM/SMFunctor.hs
instance (Monad m, SMFunctor m) => SMMonad m where
  (>>>=) ma sm = (sm', join mmb)
    where
      (sm', mmb) = smfmap sm ma
      
-}

            
ALUT-2.4.0.3
3 matches
examples/TestSuite/TestMemoryLoader.hs
withFileContents :: FilePath -> (MemoryRegion a -> IO b) -> IO b
withFileContents filePath action =
   bracket (openBinaryFile filePath ReadMode) hClose $ \handle -> do
      numBytes <- fmap fromIntegral (hFileSize handle)
      allocaBytes numBytes $ \buf -> do
         bytesRead <- hGetBuf handle buf numBytes
         when (bytesRead /= numBytes) $
            ioError (userError "hGetBuf")
         action (MemoryRegion buf (fromIntegral numBytes))

            
src/Sound/ALUT/Errors.hs

makeBuffer :: String -> IO ALuint -> IO Buffer
makeBuffer name =
   fmap fromJust . throwIf isNothing name . fmap unmarshalBuffer

            
src/Sound/ALUT/Loaders.hs
mimeTypes name loaderType =
   makeGettableStateVar $ do
      ts <- throwIfNullPtr name $ alut_GetMIMETypes loaderType
      fmap (splitBy (== ',')) $ peekCString ts

splitBy :: (a -> Bool) -> [a] -> [[a]]
splitBy _ [] = []
splitBy p xs = case break p xs of
                (ys, []  ) -> [ys]

            
AbortT-transformers-1.0.1.3
2 matches
Control/Monad/Trans/Abort.hs
newtype AbortT r m a = AbortT { unwrapAbortT :: m (Either r a) }

instance Functor m => Functor (AbortT r m) where
    fmap f = AbortT . fmap (either Left (Right . f)) . unwrapAbortT

instance Applicative m => Applicative (AbortT r m) where
    pure = AbortT . fmap Right . pure
    (AbortT m) <*> (AbortT x) = AbortT ((fmap h m) <*> x)
      where
        h (Left g) = const (Left g)
        h (Right f) = either Left (Right . f)

instance Monad m => Monad (AbortT r m) where

            
test.hs
    [testGroup "Functor"
        [testGroup "Identity"
            [testProperty "without Abort" $
                \(x :: Int) (y :: Int) → (== x+y) . runAbort . fmap (+y) . return $ x
            ,testProperty "with goto" $
                \(x :: Int) (y :: Int) → (== x) . runAbort . fmap (+y) . abort $ x
            ]
        ,testGroup "Maybe"
            [testProperty "without Abort" $
                \(x :: Int) (y :: Int) → (== Just (x+y)) . runAbortT . fmap (+y) . lift . Just $ x
            ,testProperty "with Abort" $
                \(x :: Int) (y :: Int) → (== Just x) . runAbortT . fmap (+y) . (>>= abort) . lift . Just $ x
            ]
        ]
    ,testGroup "Applicative"
        [testGroup "Identity"
            [testProperty "without Abort" $

            
Adaptive-Blaisorblade-0.23
9 matches
Control/Monad/Adaptive/CircularList.hs
         (p,_,n) <- get l
         set l (p,a,n)

val l = (\ (p,a,n) -> a) `fmap` get l

next l = (\ (p,a,n) -> n) `fmap` get l

previous l = (\ (p,a,n) -> p) `fmap` get l

insert l a = do
  (p,b,n) <- get l
  n' <- CL `fmap` newRef (l,a,n)
  set l (p,b,n')
  nl <- next n'
  (_,nb,nn) <- get nl
  set nl (n',nb,nn)
  return n'

            
Control/Monad/Adaptive/OrderedList.hs
deOL (OL f) = f

run l = do
    base <- Record `fmap` circularList (False,0,undefined)
    s <- newRef 0
    mr <- newRef m
    deOL l (mr,s,base)
  where 
    m = 2^16

            
Control/Monad/Adaptive/OrderedList.hs
  (OL m) >>= f = OL $ \e -> m e >>= \a -> deOL (f a) e

instance Ref m r => Functor (OrderedList m r a) where 
  fmap f m = m >>= return . f

instance Ref m r => Ref (OrderedList m r a) r where
  newRef v     = inM (newRef v)
  readRef r    = inM (readRef r)
  writeRef r v = inM (writeRef r v)

            
Control/Monad/Adaptive/OrderedList.hs
record :: Ref m r => Record m r a -> OrderedList m r a (Bool,Integer,a)
record r = inM (val (deR r))

rval r = (\ (d,i,a) -> a) `fmap` record r

next r = Record `fmap` inM (CircularList.next (deR r))

s x = next x

-- label
l :: Ref m r => Record m r a -> OrderedList m r a Integer

            
Control/Monad/Adaptive/OrderedList.hs

-- label
l :: Ref m r => Record m r a -> OrderedList m r a Integer
l r = (\ (d,i,a) -> i) `fmap` record r

-- gap
g e f = (l f - l e) `mod` bigM

deleted r = (\ (d,i,a) -> d) `fmap` record r

            
Control/Monad/Adaptive/OrderedList.hs
-- gap
g e f = (l f - l e) `mod` bigM

deleted r = (\ (d,i,a) -> d) `fmap` record r

lbase :: Ref m r => OrderedList m r a Integer
lbase = base >>= l

gstar :: Ref m r => Record m r a -> Record m r a -> OrderedList m r a Integer

            
Control/Monad/Adaptive/OrderedList.hs
spliceOut r s = next r >>= spl where
  spl r = do 
    unlessM (mop lbase (==) (l r)) $
        whenM ((==LT) `fmap` order r s)
              (do r' <- next r
                  delete r
                  spl r')

increaseBigM :: Ref m r => OrderedList m r a ()

            
Control/Monad/Adaptive.hs
  Ch m >>= f = Ch $ \k -> m $ \a -> deCh (f a) k

instance Ref m r => Functor (Changeable m r) where
  fmap f m = m >>= return . f

instance Ref m r => Ref (Adaptive m r) r where
  newRef v     = inM $ newRef v
  readRef x    = inM $ readRef x
  writeRef x v = inM $ writeRef x v

            
Control/Monad/Adaptive.hs
  Ad m >>= f = Ad $ \e -> m e >>= \a -> deAd (f a) e

instance Ref m r => Functor (Adaptive m r) where
  fmap f m = m >>= return . f

readMod (Mo (r,chg,es)) = do
   start <- inAd stepTime
   cont $ \k -> do
     let reader = do readRef r >>= k