Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
utf8-string
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
utf8-string
Commits
f1e25143
Unverified
Commit
f1e25143
authored
6 years ago
by
glguy
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #24 from gwils/fromChar
Add fromChar function
parents
24c8a542
9971280e
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Data/ByteString/UTF8.hs
+5
-0
5 additions, 0 deletions
Data/ByteString/UTF8.hs
with
5 additions
and
0 deletions
Data/ByteString/UTF8.hs
+
5
−
0
View file @
f1e25143
...
...
@@ -26,6 +26,7 @@ module Data.ByteString.UTF8
,
drop
,
span
,
break
,
fromChar
,
fromString
,
toString
,
foldl
...
...
@@ -43,6 +44,10 @@ import Prelude hiding (take,drop,splitAt,span,break,foldr,foldl,length,lines)
import
Codec.Binary.UTF8.String
(
encode
)
import
Codec.Binary.UTF8.Generic
(
buncons
)
-- | Converts a Haskell char into a UTF8 encoded bytestring.
fromChar
::
Char
->
B
.
ByteString
fromChar
x
=
fromString
[
x
]
-- | Converts a Haskell string into a UTF8 encoded bytestring.
fromString
::
String
->
B
.
ByteString
fromString
xs
=
B
.
pack
(
encode
xs
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment