Skip to content

Fix compiler warnings #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"dependencies": {
"purescript-eff": "^0.1.0",
"purescript-functions": "^0.1.0",
"purescript-maybe": "^0.3.0"
"purescript-maybe": "^0.3.0",
"purescript-exceptions": "^0.3.1"
}
}
9 changes: 6 additions & 3 deletions src/Graphics/Canvas.purs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ import Prelude
import Data.Function
import Data.Maybe
import Control.Monad.Eff
import Control.Monad.Eff.Exception.Unsafe (unsafeThrow)

-- | The `Canvas` effect denotes computations which read/write from/to the canvas.
foreign import data Canvas :: !
Expand All @@ -134,7 +135,7 @@ foreign import data CanvasGradient :: *
foreign import canvasElementToImageSource :: CanvasElement -> CanvasImageSource

-- | Wrapper for asynchronously loading a image file by path and use it in callback, e.g. drawImage
foreign import withImage :: forall eff a. String -> (CanvasImageSource -> Eff eff Unit) -> Eff eff Unit
foreign import withImage :: forall eff. String -> (CanvasImageSource -> Eff eff Unit) -> Eff eff Unit

foreign import getCanvasElementByIdImpl ::
forall r eff. Fn3 String
Expand Down Expand Up @@ -403,13 +404,15 @@ textAlign ctx = unsafeParseTextAlign <$> textAlignImpl ctx
unsafeParseTextAlign "center" = AlignCenter
unsafeParseTextAlign "start" = AlignStart
unsafeParseTextAlign "end" = AlignEnd
unsafeParseTextAlign align = unsafeThrow $ "invalid TextAlign: " ++ align
-- ^ dummy to silence compiler warnings

foreign import setTextAlignImpl :: forall eff. Context2D -> String -> (Eff (canvas :: Canvas | eff) Context2D)

-- | Set the current text alignment.
setTextAlign :: forall eff. Context2D -> TextAlign -> Eff (canvas :: Canvas | eff) Context2D
setTextAlign ctx textAlign =
setTextAlignImpl ctx (show textAlign)
setTextAlign ctx textalign =
setTextAlignImpl ctx (show textalign)

-- | Text metrics:
-- |
Expand Down