~alcinnz/Typograffiti

fb8655694f6fbd57f6eb23ed7694ee680102fa22 — Schell Scivally 5 years ago 6592ccb
monad fail
3 files changed, 25 insertions(+), 10 deletions(-)

M package.yaml
M src/Typograffiti/GL.hs
M stack.yaml
M package.yaml => package.yaml +18 -4
@@ 1,5 1,5 @@
name:                typograffiti
version:             0.1.0.0
version:             0.1.0.2
github:              "schell/typograffiti"
license:             BSD3
author:              "Schell Scivally"


@@ 11,14 11,28 @@ extra-source-files:
- ChangeLog.md

# Metadata used when publishing your package
synopsis:            Display TTF fonts in OpenGL. Includes caching for fast
                     rendering.
synopsis:            Just let me draw nice text already
category:            Graphics

# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description:         A library that lets you draw nice text already!
description:         This is a text rendering library that uses OpenGL
                     and freetype2 to render TTF font strings quickly. It is
                     fast enough to render large chunks of text in real
                     time. This library exists because text rendering is
                     one of the biggest hurdles in Haskell graphics
                     programming - and it shouldn't be!

                     Typograffiti includes an MTL style typeclass and a
                     default monad transformer. It does not assume you are
                     using any specific windowing solution. It does assume
                     you are using OpenGL 3.3+.

                     Pull requests are very welcome :)

                     See https://github.com/schell/typograffiti/blob/master/app/Main.hs
                     for an example.

dependencies:
- base >= 4.7 && < 5

M src/Typograffiti/GL.hs => src/Typograffiti/GL.hs +4 -4
@@ 4,7 4,8 @@
module Typograffiti.GL where

import           Control.Exception      (assert)
import           Control.Monad          (forM_, when, replicateM)
import           Control.Monad          (forM_, replicateM, when)
import           Control.Monad.Fail     (MonadFail)
import           Control.Monad.IO.Class (MonadIO (..))
import           Data.ByteString        (ByteString)
import qualified Data.ByteString.Char8  as B8


@@ 24,7 25,7 @@ import           Linear
import           Linear.V               (Finite, Size, dim, toV)


allocAndActivateTex :: MonadIO m => GLenum -> m GLuint
allocAndActivateTex :: (MonadIO m, MonadFail m) => GLenum -> m GLuint
allocAndActivateTex u = do
  [t] <- liftIO $ allocaArray 1 $ \ptr -> do
    glGenTextures 1 ptr


@@ 42,8 43,7 @@ clearErrors str = do
    assert False $ return ()


newBoundVAO
  :: MonadIO m => m GLuint
newBoundVAO :: (MonadIO m, MonadFail m) => m GLuint
newBoundVAO = do
  [vao] <- liftIO $ allocaArray 1 $ \ptr -> do
      glGenVertexArrays 1 ptr

M stack.yaml => stack.yaml +3 -2
@@ 18,7 18,8 @@
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-12.10
#resolver: lts-12.10
resolver: lts-13.4

# User packages to be built.
# Various formats can be used as shown in the example below.


@@ 62,4 63,4 @@ packages:
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor
\ No newline at end of file
# compiler-check: newer-minor